[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] OS/2 patches for master branch, try 2
From: |
Gary V. Vaughan |
Subject: |
Re: [PATCH] OS/2 patches for master branch, try 2 |
Date: |
Tue, 9 Dec 2014 20:56:15 +0000 |
> 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.
Thank you.
--
Gary V. Vaughan (gary AT gnu DOT org)