From c09fe2098718807ddbca13ee36e3e38801822946 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 25 Jan 2020 13:57:01 +0100 Subject: [PATCH] libopkg: fix skipping of leading whitespace when parsing checksums Signed-off-by: Jo-Philipp Wich --- libopkg/file_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libopkg/file_util.c b/libopkg/file_util.c index 61ff736..7e955ed 100644 --- a/libopkg/file_util.c +++ b/libopkg/file_util.c @@ -235,7 +235,7 @@ char *checksum_hex2bin(const char *src, size_t *len) { size_t slen; unsigned char *p; - const unsigned char *s = (unsigned char *)src; + const unsigned char *s; static unsigned char buf[32]; if (!src) { @@ -253,7 +253,7 @@ char *checksum_hex2bin(const char *src, size_t *len) return NULL; } - for (p = buf, *len = 0; + for (s = (unsigned char *)src, p = buf, *len = 0; slen > 0 && isxdigit(s[0]) && isxdigit(s[1]); slen--, s += 2, (*len)++) *p++ = hex2bin(s[0]) * 16 + hex2bin(s[1]); -- 2.25.1