summaryrefslogtreecommitdiff
path: root/libfetch
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:36:40 +0300
commit4b6b393a71ab94a113707bea153c767cb76bbdea (patch)
tree79a5b89556d72205752120447de4dda9cb1e937e /libfetch
parente4010ccd1df4073c71966f17db32dfda988f996c (diff)
downloadapk-tools-4b6b393a71ab94a113707bea153c767cb76bbdea.tar.gz
apk-tools-4b6b393a71ab94a113707bea153c767cb76bbdea.tar.bz2
apk-tools-4b6b393a71ab94a113707bea153c767cb76bbdea.tar.xz
apk-tools-4b6b393a71ab94a113707bea153c767cb76bbdea.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"
Diffstat (limited to 'libfetch')
-rw-r--r--libfetch/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfetch/common.c b/libfetch/common.c
index 0a51c26..4a6b867 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;