Browse Source

fix two issues found by clang's static analyser

master
Felix von Leitner 6 years ago
parent
commit
ee08bd436c
  1. 2
      scan/scan_asn1derlength.c
  2. 1
      scan/scan_varint.c

2
scan/scan_asn1derlength.c

@ -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;
}

1
scan/scan_varint.c

@ -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