1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-01 11:09:07 +00:00

Fix X509 cert date parsing for dates after 2049.

Reported by Teppo Turtiainen: http://seclists.org/nmap-dev/2015/q2/29

GeneralizedTime strings are 15 bytes (14 chars of date + 'Z'), not 14.
This commit is contained in:
dmiller
2015-04-09 13:07:34 +00:00
parent bc9a8452e0
commit b87d343443
2 changed files with 6 additions and 3 deletions

View File

@@ -305,8 +305,8 @@ static int time_to_tm(const ASN1_TIME *t, struct tm *result)
else
result->tm_year = 1900 + year;
p = t->data + 2;
} else if (t->length == 14) {
/* yyyymmddhhmmss */
} else if (t->length == 15 && t->data[t->length - 1] == 'Z') {
/* yyyymmddhhmmssZ */
result->tm_year = parse_int(t->data, 4);
if (result->tm_year < 0)
return -1;