Make x509 end-of-string-check nicer.

Use remaining instead of the total length, in case someone changes the
code later and changes pString before.
This commit is contained in:
Johanna Amann 2015-09-18 12:55:55 -07:00
parent 708ede22c6
commit 5785530c6b

View file

@ -535,7 +535,7 @@ double file_analysis::X509::GetTimeFromAsn1(const ASN1_TIME* atime, const char*
return 0; return 0;
} }
if ( pString[atime->length-1] != 'Z' ) if ( pString[remaining-1] != 'Z' )
{ {
// not valid according to RFC 2459 4.1.2.5.1 // not valid according to RFC 2459 4.1.2.5.1
reporter->Weird(fmt("Could not parse UTC time in non-YY-format in X509 certificate (x509 %s)", fid)); reporter->Weird(fmt("Could not parse UTC time in non-YY-format in X509 certificate (x509 %s)", fid));