[Github-comments] [geany/geany] New warning with GCC 7 (#1683)

Matthew Brush notifications at xxxxx
Fri Nov 10 01:16:19 UTC 2017


```
../../src/build.c: In function ‘build_load_menu_grp’:
../../src/build.c:2271:19: warning: ‘__builtin___sprintf_chk’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
   sprintf(cmdbuf, "%02u", cmd);
                   ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from ../../src/tagmanager/tm_source_file.h:13,
                 from ../../src/tagmanager/tm_tag.h:32,
                 from ../../src/app.h:31,
                 from ../../src/build.c:35:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 3 and 4 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

I believe this to be a false positive as the affected code is explicitly guarded to prevent said overflow. The new warning is [described a bit here](https://gcc.gnu.org/gcc-7/changes.html).

Making the buffer one byte larger works around the warning.

My version: gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1683
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20171110/cb64ca6a/attachment.html>


More information about the Github-comments mailing list