public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] libc/iconv: find_alias was mis-computing remaining alias table length
@ 2020-07-10 10:03 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-07-10 10:03 UTC (permalink / raw)
  To: newlib-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-10 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 10:03 [newlib-cygwin] libc/iconv: find_alias was mis-computing remaining alias table length Corinna Vinschen

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).