fix two issues found by clang's static analyser

master
leitner 9 years ago
parent 83712b7f23
commit 624412ce03

@ -46,7 +46,7 @@ size_t scan_asn1derlengthvalue(const char* src,size_t len,unsigned long long* va
size_t scan_asn1derlength(const char* src,size_t len,unsigned long long* value) {
unsigned long long l;
size_t i=scan_asn1derlengthvalue(src,len,&l);
if (l > len-i) return 0; /* make sure data would fit into buffer */
if (!i || l > len-i) return 0; /* make sure data would fit into buffer */
*value=l;
return i;
}

@ -4,7 +4,6 @@ size_t scan_varint(const char* in,size_t len, unsigned long long* n) {
size_t i;
unsigned long long l;
if (len==0) return 0;
l=0;
for (l=0, i=0; i<len; ++i) {
l+=(in[i]&0x7f) << (i*7);
if (!(in[i]&0x80)) {

Loading…
Cancel
Save