From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E971B386F447; Fri, 10 Jul 2020 10:03:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E971B386F447 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libc/iconv: find_alias was mis-computing remaining alias table length X-Act-Checkin: newlib-cygwin X-Git-Author: Keith Packard via Newlib X-Git-Refname: refs/heads/master X-Git-Oldrev: 2c33d31fa81d97addab774a2b460a3779990c132 X-Git-Newrev: 24f3c6195395b8836f51fbfaeca35062c60bb056 Message-Id: <20200710100325.E971B386F447@sourceware.org> Date: Fri, 10 Jul 2020 10:03:25 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 10:03:26 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=24f3c6195395b8836f51fbfaeca35062c60bb056 commit 24f3c6195395b8836f51fbfaeca35062c60bb056 Author: Keith Packard via Newlib Date: Thu Jul 9 16:58:47 2020 -0700 libc/iconv: find_alias was mis-computing remaining alias table length This caused the strnstr to walk off the end of the alias array and fetch invalid data. Instead of attempting to update 'len', just re-compute it based on the table end pointer that is already known. Signed-off-by: Keith Packard Diff: --- newlib/libc/iconv/lib/aliasesi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index d04cebb57..ef5ce4109 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -115,7 +115,7 @@ search_again: && (p+l == table_end || isspace (*(p+l)) || *(p+l) == '\n'))) { ptable = p + l; - len -= table - p; + len = table_end - ptable; goto search_again; }