From: Rudolf Polzer Date: Sun, 27 Nov 2011 13:15:18 +0000 (+0100) Subject: fix one possible NULL bug in d0_bignum-gmp X-Git-Tag: v0.5~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fa477630c69d155b61397375d4769c55bb9d3e14;p=xonotic%2Fd0_blind_id.git fix one possible NULL bug in d0_bignum-gmp --- diff --git a/d0_bignum-gmp.c b/d0_bignum-gmp.c index 95b95e2..d5da8b5 100644 --- a/d0_bignum-gmp.c +++ b/d0_bignum-gmp.c @@ -74,7 +74,8 @@ static void *reallocate_function (void *ptr, size_t old_size, size_t new_size) if(old_size == new_size) return ptr; data = d0_malloc(new_size); - memcpy(data, ptr, (old_size < new_size) ? old_size : new_size); + if(ptr && data) + memcpy(data, ptr, (old_size < new_size) ? old_size : new_size); d0_free(ptr); return data; }