gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] branch master updated: memorypool: better c


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: memorypool: better check for value wraps
Date: Thu, 13 Jun 2019 09:54:36 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 2c54092e memorypool: better check for value wraps
2c54092e is described below

commit 2c54092e7e608e6121addbfebbb8c6283de609f8
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Thu Jun 13 10:53:31 2019 +0300

    memorypool: better check for value wraps
---
 src/microhttpd/memorypool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 4a890967..20ab4908 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -268,7 +268,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
   /* Blocks "from the end" must not be reallocated */
   mhd_assert (old == NULL || pool->memory + pool->pos > (uint8_t*)old);
 
-  if (pool->memory + new_size + 2 * ALIGN_SIZE< pool->memory)
+  if (new_size + 2 * ALIGN_SIZE < new_size)
     return NULL; /* Value wrap, too large new_size. */
 
   if (0 != old_size)
@@ -278,7 +278,8 @@ MHD_pool_reallocate (struct MemoryPool *pool,
       if (pool->pos == ROUND_TO_ALIGN (old_offset + old_size))
         { /* "old" block is the last allocated block */
           const size_t new_apos = ROUND_TO_ALIGN (old_offset + new_size);
-          if (new_apos > pool->end)
+          if ( (new_apos > pool->end) ||
+               (new_apos < pool->pos) ) /* Value wrap */
             return NULL; /* No space */
 
           pool->pos = new_apos;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]