]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fixed __builtin_object_size() usage in buffer.h
authorTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 12:19:53 +0000 (15:19 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 12:19:53 +0000 (15:19 +0300)
With type=3 size for unknown objects is set to 0, which causes a compiler
failure. With type=1 it's (size_t)-1, which passes the check.

src/lib/buffer.h

index 54dcaa45895dac1bf5f33910fcbdd6db480a60b1..f924a930455b086c5bc6f7604710aac38dcfe1fd 100644 (file)
@@ -20,10 +20,10 @@ void buffer_create_from_const_data(buffer_t *buffer,
                                   const void *data, size_t size);
 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 401
 #define buffer_create_from_data(b,d,s) ({                                      \
-       (void)COMPILE_ERROR_IF_TRUE(__builtin_object_size((d),3) < ((s)?(s):1)); \
+       (void)COMPILE_ERROR_IF_TRUE(__builtin_object_size((d),1) < ((s)?(s):1)); \
        buffer_create_from_data((b), (d), (s)); })
 #define buffer_create_from_const_data(b,d,s) ({                                        \
-       (void)COMPILE_ERROR_IF_TRUE(__builtin_object_size((d),3) < ((s)?(s):1)); \
+       (void)COMPILE_ERROR_IF_TRUE(__builtin_object_size((d),1) < ((s)?(s):1)); \
        buffer_create_from_const_data((b), (d), (s)); })
 #endif
 /* Creates a dynamically growing buffer. Whenever write would exceed the