From 4eb997d52b05a005f82f4fee5f55fd3bec1bb2a9 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 19 Jan 2017 16:18:31 -0800 Subject: [PATCH] DO NOT MERGE: resolve merge conflicts of 5346da02 to klp-modular-dev Change-Id: Ie52a9abae416bbb84ddc61bb7159a531de778c15 --- verifier.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/verifier.cpp b/verifier.cpp index 0930fbd1..c0b2bde4 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);