[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] OS/2 patches for master branch, try 2
From: |
KO Myung-Hun |
Subject: |
Re: [PATCH] OS/2 patches for master branch, try 2 |
Date: |
Wed, 10 Dec 2014 09:57:47 +0900 |
User-agent: |
Mozilla/5.0 (OS/2; Warp 4.5; rv:10.0.6esrpre) Gecko/20120715 Firefox/10.0.6esrpre SeaMonkey/2.7.2 |
Gary V. Vaughan wrote:
>
>> On Dec 9, 2014, at 6:14 AM, KO Myung-Hun <address@hidden> wrote:
>>
>> Ping ?
>
> Thanks for the gently reminder.
>
>> KO Myung-Hun wrote:
>> [...]
>>>
>>> I found some problems.
>>>
>>> 1. A null-terminator may not be appended.
>>> 2. A length is invalidated when a path is truncated really.
>>>
>>> I attach the fix.
>>>
>> [...]
>>>
>>> 0001-libm4-fix-regression-of-2c19e82d5d813565abfc2aca0085.patch
>>>
>>>
>>> From f1c831594e4e44d5c64d43bacd619376de750be1 Mon Sep 17 00:00:00 2001
>>> From: KO Myung-Hun <address@hidden>
>>> Date: Sat, 22 Nov 2014 12:34:14 +0900
>>> Subject: [PATCH] libm4: fix regression of
>>> 2c19e82d5d813565abfc2aca0085e1da339416fd
>>>
>>> path_truncate() expects a null-terminated string. So ensure that a
>>> null-terminator is appended.
>>>
>>> path_truncate() may change path. So re-calculate a length of path
>>> after path_truncate().
>>>
>>> * m4/path.c (m4_path_search): Ensure that a null-terminator is
>>> appended. Re-calculate a length of path after path_truncate().
>>> ---
>>> m4/path.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/m4/path.c b/m4/path.c
>>> index 44ed620..7243447 100644
>>> --- a/m4/path.c
>>> +++ b/m4/path.c
>>> @@ -227,7 +227,8 @@ m4_path_search (m4 *context, const char *filename,
>>> const char **suffixes)
>>> size_t mem = strlen (filename);
>>>
>>> /* Try appending each of the suffixes we were given. */
>>> - filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len
>>> +1), filename, mem));
>>> + filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len
>>> +1), filename, mem + 1));
>>> + mem = strlen (filepath);
>>> for (i = 0; suffixes && suffixes[i]; ++i)
>>> {
>>> strcpy (filepath + mem, suffixes[i]);
>>> @@ -268,7 +269,8 @@ m4_path_search (m4 *context, const char *filename,
>>> const char **suffixes)
>>> /* Capture errno only when searching `.'. */
>>> e = errno;
>>>
>>> - filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len
>>> +1), pathname, mem));
>>> + filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len
>>> +1), pathname, mem + 1));
>>> + mem = strlen (filepath);
>>> free (pathname);
>>>
>>> for (i = 0; suffixes && suffixes[i]; ++i)
>
> Applied and pushed, with some minor edits to avoid nesting calls so deeply!
>
> I'm working on this part of the code actually, so I thought I'd rebase
> over your changes so I don't lose them during refactoring.
>
Please, s/FILE_TRUNCATE/TRUNCATE_FILENAME/
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM
Korean OS/2 User Community : http://www.ecomstation.co.kr