Mail Archives: djgpp-workers/2017/05/05/13:33:33
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f
|
X-Recipient: | djgpp-workers AT delorie DOT com
|
Message-ID: | <590CB802.6000903@gmx.de>
|
Date: | Fri, 05 May 2017 19:36:02 +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>
|
User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7
|
MIME-Version: | 1.0
|
To: | djgpp-workers AT delorie DOT com
|
Subject: | Re: gcc-7.1.0
|
References: | <6953e282-24aa-2b4e-2141-385d8b443111 AT iki DOT fi> <590A6154 DOT 8010308 AT gmx DOT de> <83a86shf9d DOT fsf AT gnu DOT org> <590BA4E2 DOT 4000406 AT gmx DOT de> <49ae1668-e108-5e0b-350c-533d29574dba AT iki DOT fi>
|
In-Reply-To: | <49ae1668-e108-5e0b-350c-533d29574dba@iki.fi>
|
X-Provags-ID: | V03:K0:5hyKxP6G1NcjUPjfwu53P9WKYErGrj35wC3zbn0j2ODqIGigh9o
|
| jQg43qqIjsBnxpz/ZxDif6iGonCtTqnM4nctvojFp3b96J/h1rIyl8YIfsaaf50ltkrMOAq
|
| rm2I7p06F0DH/uU8szQg4kIsIQcHY+Yzywr/0xYmK7zlh8ABrtuPFd8H8wFp3EtmnFabSIo
|
| BHczlFmAgXZPDgZ0C2f/A==
|
X-UI-Out-Filterresults: | notjunk:1;V01:K0:q88L6/Min4M=:anguLP0V3WrABt9mJ8HO4w
|
| XXLX1g0eo1mCKgVZDtA6gS7Yx5Qqdks+cNo4JDMUyAvJ0UIyM/Cbouj1eNfBlKyXC5cY8xUzw
|
| 0xPbOwbp4eB9tKxLCLQ6b4g53F13hEMGnEEIEDThFoap2khwLPZ410S2qUkmrQ18zdyhUfo4Y
|
| OXJR6JfhPrEg/Gtantg43eXQsRy2VN2K+C/LRexQmjIoBvIq0q+fbi8GRRw2f7gUkBkWpZPCX
|
| 1EkbxrlP4ku3qGcRdKSoSsWjkuU6mJrHOvkwLCM9CJkfbGT1KhWDDs8fCszSmytxJgN+4sz44
|
| +KqmuKp/D7ReMIE88o6t2C3BMNt+1crnOCs/gizFgRCW9UVFBaeeldioLkieRZuDhLiAMk4wW
|
| t51rANSxxxe4wkiju0akJYWSmP5i+7eh5E1IJ7xibG37TH8+dX/ogBRPaw2sMsrx8pZbFQpem
|
| Df/VgQAlXxTxCt3N2KDJMEy2T+jjfDD7s1XC7qkbLpLgq36fe6VoZnjb6hhZAdBDu2ytRbxip
|
| TuVi9PWLOJ1rfd0V0NK/4t8yrP6IzTUtTt1QwBW8aXHtpQqnE8k/OJSWxnn+BsWu1ctas0IPR
|
| dpCvA0EvxsaSPOPGTyK1z5+Z8lnlDckqHYaI+zCtS9Mu5oHntL/owq75h1OlXWxo5rYvddIPS
|
| 6mAMg1MbTVW4gY5pVuLYVKlwMtNQrxnXT+x8j+hlUvQ6h0BxSeqoeWeKja6U55DIl+GmA5bAo
|
| 2uoq/eNoKJjyXs3qZnqNY3Ww0Aes5P7j2oyp55dBQU3kBy3Z58BdeMpPBIyerVF029t8AOH/J
|
| RIf8Me+
|
Reply-To: | djgpp-workers AT delorie DOT com
|
Am 05.05.2017 06:12, schrieb Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp-workers AT delorie DOT com]:
> 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
>
>
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)); <-- OK with me
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, <-- not OK with me
! (unsigned short)(tbuf_beg >> 4), (unsigned short)(rm_off & 0xffff), <-- OK with me
! (unsigned short)(tbuf_beg >> 4), (unsigned short)(si_off & 0xffff)); <-- OK with me
if (!found_si)
proxy_cmdline[22] = 0; /* remove stubinfo information */
The changes are OK for me but I do not understand at all why you are assuming that an allocation
of 34 bytes for proxy_cmdline shall be sufficient. It shall contain __PROXY and this string
is supposed to have a size of __PROXY_LEN bytes. Or am I missing something? That the compiler
does not complain may not imply that it is capable to really calculate the correct length.
Neither less, please feel free to fix it as you prefer. I agree that the implemented fix shall
make minimal changes.
Regards,
Juan M. Guerrero
- Raw text -