From: Florian Dold Date: Fri, 24 Apr 2020 08:20:05 +0000 (+0530) Subject: check for integer overflow in buffer lib (fixes #6217) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=892bd3c6013f0a8c44106f16299a34d9a1c99e48;p=oweals%2Fgnunet.git check for integer overflow in buffer lib (fixes #6217) --- diff --git a/src/util/buffer.c b/src/util/buffer.c index 8efb3e284..dabf630c7 100644 --- a/src/util/buffer.c +++ b/src/util/buffer.c @@ -56,6 +56,8 @@ GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, { size_t new_capacity = buf->position + n; + /* guard against overflow */ + GNUNET_assert (new_capacity >= buf->position); if (new_capacity <= buf->capacity) return; /* warn if calculation of expected size was wrong */