public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] libc/iconv: find_alias was mis-computing remaining alias table length
Date: Fri, 10 Jul 2020 10:03:25 +0000 (GMT)	[thread overview]
Message-ID: <20200710100325.E971B386F447@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=24f3c6195395b8836f51fbfaeca35062c60bb056

commit 24f3c6195395b8836f51fbfaeca35062c60bb056
Author: Keith Packard via Newlib <newlib@sourceware.org>
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 <keithp@keithp.com>

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;
     }


                 reply	other threads:[~2020-07-10 10:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710100325.E971B386F447@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).