r22019: Jeremy, this hopefully fixes the build farm currently. But I think we need
authorVolker Lendecke <vlendec@samba.org>
Sun, 1 Apr 2007 13:50:02 +0000 (13:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:02 +0000 (12:19 -0500)
another get_safe_offset call that also includes the required buffer size.

Volker

source/lib/util.c

index 809071662d5ea43dadb2c4aa3a3aba7eeaa06ea0..b74c08991ae8446de23fb3b984d68369ad5550df 100644 (file)
@@ -3132,7 +3132,7 @@ int this_is_smp(void)
 char *get_safe_offset(const char *buf_base, size_t buf_len, char *ptr, size_t off)
 {
        const char *end_base = buf_base + buf_len;
-       const char *end_ptr = ptr + off;
+       char *end_ptr = ptr + off;
 
        if (!buf_base || !ptr) {
                return NULL;
@@ -3143,7 +3143,7 @@ char *get_safe_offset(const char *buf_base, size_t buf_len, char *ptr, size_t of
        }
 
        if (end_ptr < end_base) {
-               return ptr;
+               return end_ptr;
        }
        return NULL;
 }