]> git.rm.cloudns.org Git - xonotic/d0_blind_id.git/commitdiff
fix possible overrun
authorRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 11:59:28 +0000 (13:59 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 11:59:28 +0000 (13:59 +0200)
d0_bignum-tommath.c

index 966bd057ecb61bda12e5542b7f0c6dc3dfd34527..414d5af95cc602c019d4adf003e3836a9cd37948 100644 (file)
@@ -177,7 +177,8 @@ ssize_t d0_bignum_export_unsigned(const d0_bignum_t *bignum, void *buf, size_t b
                memset(buf, 0, bufsize - count);
                buf += bufsize - count;
        }
-       mp_to_unsigned_bin_n(&bignum->z, buf, &count);
+       bufsize = count;
+       mp_to_unsigned_bin_n(&bignum->z, buf, &bufsize);
        if(bufsize > count)
        {
                // REALLY BAD