Skip to content

7.44.0: asn1_output does not handle 4-digit year #427

@srkemp

Description

@srkemp

Using curl 7.44.0
I saw the following (partial) output from running curl in verbose mode:

  •    start date: 2015-09-08 10:43:39 GMT
    
  •    expire date: 2015-09-08 10:43:39 GMT
    

Note the dates are the same, but this is not the case in the actual certificate.

Digging further, there is a bug in file lib/vtls/openssl.c function asn1_output(); it does not cater for a 4-digit year in the input field.

e.g. here is some output from the function itself showing the fields in the input "tm" and each character in the "tm->data" field. The first set is correct, and the second has a 4-digit year which causes an error.

The calling code (in get_cert_chain) does not check the return-code (to print the "not before" and "not after" dates in a certificate), hence the same buffer is printed for the "expire date"

Debug output:

// Correct output, for the "start date"
tm->length=13
tm->type=23
0: 0x31 '1'
1: 0x35 '5'
2: 0x30 '0'
3: 0x39 '9'
4: 0x30 '0'
5: 0x38 '8'
6: 0x31 '1'
7: 0x30 '0'
8: 0x34 '4'
9: 0x33 '3'
10: 0x33 '3'
11: 0x39 '9'
12: 0x5a 'Z'

  •    start date: 2015-09-08 10:43:39 GMT
    

// Incorrect, for the "expire date"
tm->length=15
tm->type=24
0: 0x32 '2'
1: 0x31 '1'
2: 0x31 '1'
3: 0x35 '5'
4: 0x30 '0'
5: 0x38 '8'
6: 0x31 '1'
7: 0x35 '5'
8: 0x31 '1'
9: 0x30 '0'
10: 0x34 '4'
11: 0x33 '3'
12: 0x33 '3'
13: 0x39 '9'
14: 0x5a 'Z'

  •    expire date: 2015-09-08 10:43:39 GMT
    

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions