summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Packard via Newlib <newlib@sourceware.org>2020-07-09 16:58:47 -0700
committerCorinna Vinschen <corinna@vinschen.de>2020-07-10 10:51:43 +0200
commit24f3c6195395b8836f51fbfaeca35062c60bb056 (patch)
tree4224efdf2b3d04006c6699a2bfec3df1c1c4f711
parent2c33d31fa81d97addab774a2b460a3779990c132 (diff)
downloadcygnal-24f3c6195395b8836f51fbfaeca35062c60bb056.tar.gz
cygnal-24f3c6195395b8836f51fbfaeca35062c60bb056.tar.bz2
cygnal-24f3c6195395b8836f51fbfaeca35062c60bb056.zip
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>
-rw-r--r--newlib/libc/iconv/lib/aliasesi.c2
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;
}