summaryrefslogtreecommitdiff
path: root/src/archive.c
diff options
context:
space:
mode:
authorDmitry Golovin <dima@golovin.in>2017-08-22 17:28:21 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-08-23 08:56:44 +0300
commit16336ba2655db7f1df78437deb6de84d16c7c3c1 (patch)
tree557d7aaf407953b431f0d4cc4146afff6ffd336f /src/archive.c
parent04003569c54d3cfce7ae7d06199c2ca1e510f38a (diff)
downloadapk-tools-16336ba2655db7f1df78437deb6de84d16c7c3c1.tar.gz
apk-tools-16336ba2655db7f1df78437deb6de84d16c7c3c1.tar.bz2
apk-tools-16336ba2655db7f1df78437deb6de84d16c7c3c1.tar.xz
apk-tools-16336ba2655db7f1df78437deb6de84d16c7c3c1.zip
fix comparison of unsigned expression < 0 is always false
found by clang
Diffstat (limited to 'src/archive.c')
-rw-r--r--src/archive.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/archive.c b/src/archive.c
index b1f9c30..9196cb2 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -159,8 +159,9 @@ static void handle_extended_header(struct apk_file_info *fi, apk_blob_t hdr)
unsigned int len = apk_blob_pull_uint(&hdr, 10);
apk_blob_pull_char(&hdr, ' ');
if (!apk_blob_split(hdr, APK_BLOB_STR("="), &name, &hdr)) break;
+ if (len < hdr.ptr - start + 1) break;
len -= hdr.ptr - start + 1;
- if (len < 0 || hdr.len < len) break;
+ if (hdr.len < len) break;
value = APK_BLOB_PTR_LEN(hdr.ptr, len);
hdr = APK_BLOB_PTR_LEN(hdr.ptr+len, hdr.len-len);
apk_blob_pull_char(&hdr, '\n');