Mail Archives: djgpp-workers/2017/05/05/00:12:19
This is a multi-part message in MIME format.
--------------B5A5A971A22346F451499279
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
On 05/05/2017 01:02 AM, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp-workers AT delorie DOT com]
wrote:
> Am 04.05.2017 16:23, schrieb Eli Zaretskii (eliz AT gnu DOT org) [via djgpp-workers AT delorie DOT com]:
>>> 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>
> [snip]
>>
>> It's probably best to tweak the code to make sure the buffer overruns
>> cannot happen.
>
> I have tried to fix the buffer overruns by recomputing the length correctly
> so the compiler stops complaining. Also some minor warnings in the zoneinfo
> code has been fixed but they do not stop compilation. I have added "break"
> in switch statements where they are missed. Neitherless there are some
> warnings due to intentional fall throughs that may be suppressed by excluding
> the corresponding compiler warning settings [-Wimplicit-fallthrough=].
>
> As usual suggestions, objections, comments are welcome.
>
>
> Regards,
> Juan M. Guerrero
>
I guess better way is to add explicit casts to unsigned short. Attached patch seems to be sufficient.
Tested however build only using Linux to DJGPP cross-compiler.
Andris
--------------B5A5A971A22346F451499279
Content-Type: text/x-patch;
name="dosexec.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="dosexec.c.diff"
Index: dosexec.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/process/dosexec.c,v
retrieving revision 1.27
diff -p -r1.27 dosexec.c
*** dosexec.c 2 May 2015 07:32:23 -0000 1.27
--- dosexec.c 5 May 2017 04:04:28 -0000
*************** direct_exec_tail_1 (const char *program,
*** 406,412 ****
if ((initial_tbuf_selector != tbuf_selector) && proxy_off)
{
char temp[65], *s, t2[5];
! sprintf (t2, "%04lX", tbuf_beg>>4);
dosmemget (tbuf_beg+proxy_off, 64, temp);
temp[64] = 0;
s = strchr(temp,'\r');
--- 406,412 ----
if ((initial_tbuf_selector != tbuf_selector) && proxy_off)
{
char temp[65], *s, t2[5];
! sprintf (t2, "%04X", (unsigned short)(tbuf_beg>>4));
dosmemget (tbuf_beg+proxy_off, 64, temp);
temp[64] = 0;
s = strchr(temp,'\r');
*************** static int go32_exec(const char *program
*** 1107,1115 ****
proxy_cmdline = (char *)alloca (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);
if (!found_si)
proxy_cmdline[22] = 0; /* remove stubinfo information */
--- 1107,1115 ----
proxy_cmdline = (char *)alloca (34);
sprintf(proxy_cmdline, "%s=%04x %04x %04x %04x %04x",
! __PROXY, (unsigned short)argc,
! (unsigned short)(tbuf_beg >> 4), (unsigned short)(rm_off & 0xffff),
! (unsigned short)(tbuf_beg >> 4), (unsigned short)(si_off & 0xffff));
if (!found_si)
proxy_cmdline[22] = 0; /* remove stubinfo information */
--------------B5A5A971A22346F451499279--
- Raw text -