Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect snprintf invocation with static buffer #37

Closed
derickr opened this issue May 11, 2018 · 0 comments
Closed

Incorrect snprintf invocation with static buffer #37

derickr opened this issue May 11, 2018 · 0 comments
Assignees
Labels

Comments

@derickr
Copy link
Owner

derickr commented May 11, 2018

When compiling timelib with -O2 and GCC 8.1, the following compile warning is shown:

src/third_party/timelib-2018.01alpha1/parse_zoneinfo.c: In function ‘create_zone_index.constprop’:
src/third_party/timelib-2018.01alpha1/parse_zoneinfo.c:118:40: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
  snprintf(fname, sizeof(fname), "%s%s%s", directory, TIMELIB_DIR_SEPARATOR, timezone /* canonical_tzname(timezone) */);
                                        ^
In file included from /usr/include/stdio.h:862,
                 from src/third_party/timelib-2018.01alpha1/timelib_private.h:70,
                 from src/third_party/timelib-2018.01alpha1/parse_zoneinfo.c:27:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 2 or more bytes (assuming 4097) into a destination of size 4096
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant