vigna / ne

ne, the nice editor
http://ne.di.unimi.it/
GNU General Public License v3.0
474 stars 33 forks source link

truncation warning #98

Closed polluks2 closed 2 years ago

polluks2 commented 2 years ago

c99 -std=c99 -Wall -Wno-parentheses -fno-strict-aliasing -flto=auto -ffat-lto-objects -Wp,-D_FORTIFY_SOURCE=2 -D_REGEX_LARGE_OFFSETS -D_GNU_SOURCE -DSTDC_HEADERS -DHAVE_SNPRINTF   -O3 -DNDEBUG      -c -o syntax.o syntax.c
In file included from ne.h:31,
                 from syntax.c:22:
syntax.c: In function 'parse_color_def':
syn_types.h:42:78: warning: '__snprintf_chk' output may be truncated before the last format character [-Wformat-truncation=]
 #define joe_snprintf_2(buf,len,fmt,a,b) snprintf((char *)(buf),(len),(char *)(fmt),(a),(b))
                                                                              ^
In file included from /usr/include/stdio.h:873,
                 from ne.h:22,
                 from syntax.c:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: '__snprintf_chk' output 2 or more bytes (assuming 257) into a destination of size 256
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ne.h:31,
                 from syntax.c:22:
syn_types.h:42:78: warning: '__snprintf_chk' output may be truncated before the last format character [-Wformat-truncation=]
 #define joe_snprintf_2(buf,len,fmt,a,b) snprintf((char *)(buf),(len),(char *)(fmt),(a),(b))
                                                                              ^
In file included from /usr/include/stdio.h:873,
                 from ne.h:22,
                 from syntax.c:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: '__snprintf_chk' output 2 or more bytes (assuming 257) into a destination of size 256
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vigna commented 2 years ago

Well, let's hope not, but that code is straight from Joe...