summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-01-20 01:18:31 +0100
committerTianjie Xu <xunchang@google.com>2017-01-20 01:18:31 +0100
commit4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9 (patch)
tree7280cc707ebf6b447cbd684b5c296bf58e4ddb20
parentDO NOT MERGE: Add a checker for signature boundary in verifier am: f616da1726 (diff)
downloadandroid_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar.gz
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar.bz2
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar.lz
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar.xz
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.tar.zst
android_bootable_recovery-4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9.zip
-rw-r--r--verifier.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/verifier.cpp b/verifier.cpp
index 0930fbd15..c0b2bde4c 100644
--- a/verifier.cpp
+++ b/verifier.cpp
@@ -155,6 +155,13 @@ int verify_file(const char* path, const Certificate* pKeys, unsigned int numKeys
LOGI("comment is %d bytes; signature %d bytes from end\n",
comment_size, signature_start);
+ if (signature_start > comment_size) {
+ LOGE("signature start: %zu is larger than comment size: %zu\n", signature_start,
+ comment_size);
+ fclose(f);
+ return VERIFY_FAILURE;
+ }
+
if (signature_start <= FOOTER_SIZE) {
LOGE("Signature start is in the footer");
fclose(f);