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

Fix building with gcc7 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix building with gcc7 #13

wants to merge 1 commit into from

Conversation

XRevan86
Copy link

@XRevan86 XRevan86 commented Jun 12, 2017

tl-parser.c: In function 'tl_parse_args134':
tl-parser.c:1907:21: error: '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
         sprintf (s, "%lld", lrand48 () * (1ll << 32) + lrand48 ());
                     ^~~~~~
In file included from /usr/include/stdio.h:939:0,
                 from tl-parser.c:32:
/usr/include/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 21 bytes into a destination of size 20
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looks like it tries to count the possible "minus" symbol too. But lrand48() is factually non-negative, so looks reasonable to explicitly write down an unsigned integer.

@korbino
Copy link

korbino commented Jan 2, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants