|
@@ -655,10 +655,16 @@ int asn1_generalized_time ( const struct asn1_cursor *cursor, time_t *time ) {
|
655
|
655
|
}
|
656
|
656
|
|
657
|
657
|
/* Parse digit string a pair at a time */
|
|
658
|
+ memset ( &pairs, 0, sizeof ( pairs ) );
|
658
|
659
|
data = contents.data;
|
659
|
660
|
remaining = contents.len;
|
660
|
661
|
for ( i = ( have_century ? 0 : 1 ) ; i < sizeof ( pairs.raw ) ; i++ ) {
|
661
|
662
|
if ( remaining < 2 ) {
|
|
663
|
+ /* Some certificates violate the X.509 RFC by
|
|
664
|
+ * omitting the "seconds" value.
|
|
665
|
+ */
|
|
666
|
+ if ( i == ( sizeof ( pairs.raw ) - 1 ) )
|
|
667
|
+ break;
|
662
|
668
|
DBGC ( cursor, "ASN1 %p invalid time:\n", cursor );
|
663
|
669
|
DBGC_HDA ( cursor, 0, cursor->data, cursor->len );
|
664
|
670
|
return -EINVAL_ASN1_TIME;
|