diff options
| author | Jo-Philipp Wich | 2020-01-25 12:57:01 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2020-01-25 12:57:01 +0000 |
| commit | c09fe2098718807ddbca13ee36e3e38801822946 (patch) | |
| tree | 74a2ea54a56be31bd61a666e7a5ca088a79581eb | |
| parent | 80d161eb5b95ceb51db989196405eaa00950e03b (diff) | |
| download | opkg-lede-c09fe2098718807ddbca13ee36e3e38801822946.tar.gz | |
libopkg: fix skipping of leading whitespace when parsing checksums
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
| -rw-r--r-- | libopkg/file_util.c | 4 |
1 files 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]); |