From 404ae3514fbbdb51e32af1c2c1434acacf5ec20c Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 13 Aug 2012 20:40:47 +0000 Subject: Fix various issues flagged by cppcheck. Nothing too interesting. --- src/pk_pad/emsa1/emsa1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pk_pad') diff --git a/src/pk_pad/emsa1/emsa1.cpp b/src/pk_pad/emsa1/emsa1.cpp index 7f9a1885f..2358023f8 100644 --- a/src/pk_pad/emsa1/emsa1.cpp +++ b/src/pk_pad/emsa1/emsa1.cpp @@ -81,11 +81,11 @@ bool EMSA1::verify(const secure_vector& coded, secure_vector our_coding = emsa1_encoding(raw, key_bits); if(our_coding == coded) return true; - if(our_coding[0] != 0) return false; + if(our_coding.empty() || our_coding[0] != 0) return false; if(our_coding.size() <= coded.size()) return false; size_t offset = 0; - while(our_coding[offset] == 0 && offset < our_coding.size()) + while(offset < our_coding.size() && our_coding[offset] == 0) ++offset; if(our_coding.size() - offset != coded.size()) return false; -- cgit v1.2.3