X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Subject: Re: gcc-7.1.0 To: djgpp-workers AT delorie DOT com 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> From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp-workers AT delorie DOT com]" Message-ID: <49ae1668-e108-5e0b-350c-533d29574dba@iki.fi> Date: Fri, 5 May 2017 07:12:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <590BA4E2.4000406@gmx.de> Content-Type: multipart/mixed; boundary="------------B5A5A971A22346F451499279" Content-Language: en-US Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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]" > [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--