]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: data-stack - disambiguate sizes in t_pop_verify
authorPhil Carmody <phil@dovecot.fi>
Mon, 28 Jul 2014 13:45:33 +0000 (16:45 +0300)
committerPhil Carmody <phil@dovecot.fi>
Mon, 28 Jul 2014 13:45:33 +0000 (16:45 +0300)
In DEBUG mode, the allocated size is bigger than the requested size, so
rename the variable to reflect its real meaning, and move it into a
tighter scope in the process.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib/data-stack.c

index f141214181a45aeb12f319e981ee69b773a812b2..8e606c9e7cbfd7409a3c61a9b1d070e900be225a 100644 (file)
@@ -223,7 +223,7 @@ static void t_pop_verify(void)
 {
        struct stack_block *block;
        unsigned char *p;
-       size_t pos, max_pos, used_size, alloc_size;
+       size_t pos, max_pos, used_size;
 
        block = current_frame_block->block[frame_pos];
        pos = block->size - current_frame_block->block_space_used[frame_pos];
@@ -232,13 +232,13 @@ static void t_pop_verify(void)
                used_size = block->size - block->left;
                p = STACK_BLOCK_DATA(block);
                while (pos < used_size) {
-                       alloc_size = *(size_t *)(p + pos);
-                       if (used_size - pos < alloc_size)
+                       size_t requested_size = *(size_t *)(p + pos);
+                       if (used_size - pos < requested_size)
                                i_panic("data stack[%s]: saved alloc size broken",
                                        current_frame_block->marker[frame_pos]);
-                       pos += MEM_ALIGN(sizeof(alloc_size));
-                       max_pos = pos + MEM_ALIGN(alloc_size + SENTRY_COUNT);
-                       pos += alloc_size;
+                       pos += MEM_ALIGN(sizeof(size_t));
+                       max_pos = pos + MEM_ALIGN(requested_size + SENTRY_COUNT);
+                       pos += requested_size;
 
                        for (; pos < max_pos; pos++) {
                                if (p[pos] != CLEAR_CHR)