Mail Archives: djgpp-workers/2017/05/04/10:24:27
> Date: Thu, 04 May 2017 01:01:40 +0200
> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp-workers AT delorie DOT com]" <djgpp-workers AT delorie DOT com>
>
> gcc ... -c dosexec.c
> dosexec.c: In function 'direct_exec_tail':
> dosexec.c:409:19: warning: '%04lX' directive writing between 4 and 7 bytes into a region of size 5 [-Wformat-overflow=]
> sprintf (t2, "%04lX", tbuf_beg>>4);
> ^~~~~
> dosexec.c:409:18: note: directive argument in the range [0, 268435455]
> sprintf (t2, "%04lX", tbuf_beg>>4);
> ^~~~~~~
> dosexec.c:409:5: note: 'sprintf' output between 5 and 8 bytes into a destination of size 5
> sprintf (t2, "%04lX", tbuf_beg>>4);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> dosexec.c: In function 'go32_exec':
> dosexec.c:1109:50: warning: '%04x' directive writing 4 bytes into a region of size between 3 and 13 [-Wformat-overflow=]
> sprintf(proxy_cmdline, "%s=%04x %04x %04x %04x %04x",
> ^~~~
> dosexec.c:1109:26: note: directive argument in the range [0, 65535]
> sprintf(proxy_cmdline, "%s=%04x %04x %04x %04x %04x",
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> dosexec.c:1109:3: note: 'sprintf' output 26 or more bytes (assuming 36) into a destination of size 34
> sprintf(proxy_cmdline, "%s=%04x %04x %04x %04x %04x",
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> __PROXY, argc,
> ~~~~~~~~~~~~~~
> (unsigned)(tbuf_beg >> 4), rm_off & 0xffff,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> (unsigned)(tbuf_beg >> 4), si_off & 0xffff);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's probably best to tweak the code to make sure the buffer overruns
cannot happen.
- Raw text -