summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-08-03 21:33:49 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-08-03 21:33:49 +0300
commitb30e94c0aca10b57ce734f7fcf9b7600537dc136 (patch)
treed0a5aa6517f7ba925087597521d7c54bb25bafd1
parentaa44cfac05bb4bd6f336ebbfd7b26deca8a19075 (diff)
downloadapk-tools-b30e94c0aca10b57ce734f7fcf9b7600537dc136.tar.gz
apk-tools-b30e94c0aca10b57ce734f7fcf9b7600537dc136.tar.bz2
apk-tools-b30e94c0aca10b57ce734f7fcf9b7600537dc136.tar.xz
apk-tools-b30e94c0aca10b57ce734f7fcf9b7600537dc136.zip
libfetch: fix http chunked mode handling
Unbreak handling of base 16 in fetch_parseuint(). It is used only in http chunked mode handling. Fixes: "libfetch: fix range checking for http/ftp protocol parsing"
-rw-r--r--libfetch/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfetch/common.c b/libfetch/common.c
index 01c5f2b..248b575 100644
--- a/libfetch/common.c
+++ b/libfetch/common.c
@@ -181,7 +181,7 @@ fetch_parseuint(const char *str, const char **endptr, int radix, uintmax_t max)
unsigned char ch = (unsigned char)*p;
if (isdigit(ch))
d = ch - '0';
- else d = tolower(ch - 'a');
+ else d = tolower(ch) - 'a' + 10;
if (d > radix || val > maxx) goto err;
val *= radix;
if (val > max-d) goto err;