diff options
author | Keith Packard via Newlib <newlib@sourceware.org> | 2020-07-10 02:58:47 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-07-10 11:51:43 +0300 |
commit | 24f3c6195395b8836f51fbfaeca35062c60bb056 (patch) | |
tree | 4224efdf2b3d04006c6699a2bfec3df1c1c4f711 /newlib/libc/iconv/lib | |
parent | 2c33d31fa81d97addab774a2b460a3779990c132 (diff) |
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>
Diffstat (limited to 'newlib/libc/iconv/lib')
-rw-r--r-- | newlib/libc/iconv/lib/aliasesi.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |