Before calling ASN1_time_parse() initialize the struct tm. While
authorclaudio <claudio@openbsd.org>
Tue, 11 May 2021 11:32:51 +0000 (11:32 +0000)
committerclaudio <claudio@openbsd.org>
Tue, 11 May 2021 11:32:51 +0000 (11:32 +0000)
recent libressl version initalise the struct tm properly older
versions did not and so -portable runs into problem on systems
with older libressl versions installed.
Problem found by job@
OK tb@

usr.sbin/rpki-client/mft.c
usr.sbin/rpki-client/parser.c
usr.sbin/rpki-client/roa.c

index 757e959..e1c68ac 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mft.c,v 1.33 2021/05/09 11:25:32 tb Exp $ */
+/*     $OpenBSD: mft.c,v 1.34 2021/05/11 11:32:51 claudio Exp $ */
 /*
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -70,6 +70,7 @@ generalizedtime_to_tm(const ASN1_GENERALIZEDTIME *gtime, struct tm *tm)
        data = ASN1_STRING_get0_data(gtime);
        len = ASN1_STRING_length(gtime);
 
+       memset(tm, 0, sizeof(*tm));
        return ASN1_time_parse(data, len, tm, V_ASN1_GENERALIZEDTIME) ==
            V_ASN1_GENERALIZEDTIME;
 }
index 6f05644..6451069 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parser.c,v 1.9 2021/05/09 11:18:57 tb Exp $ */
+/*     $OpenBSD: parser.c,v 1.10 2021/05/11 11:32:51 claudio Exp $ */
 /*
  * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -101,6 +101,7 @@ proc_parser_roa(struct entity *entp,
                        err(1, "X509_CRL_get0_nextUpdate failed");
                        goto out;
                }
+               memset(&expires_tm, 0, sizeof(expires_tm));
                if (ASN1_time_parse(at->data, at->length, &expires_tm,
                    V_ASN1_UTCTIME) != V_ASN1_UTCTIME) {
                        err(1, "ASN1_time_parse failed");
@@ -126,6 +127,7 @@ proc_parser_roa(struct entity *entp,
                        err(1, "X509_get0_notafter failed");
                        goto out;
                }
+               memset(&expires_tm, 0, sizeof(expires_tm));
                if (ASN1_time_parse(at->data, at->length, &expires_tm,
                    V_ASN1_UTCTIME) != V_ASN1_UTCTIME) {
                        err(1, "ASN1_time_parse failed");
index 236df32..4bcf60e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: roa.c,v 1.18 2021/05/06 17:03:57 job Exp $ */
+/*     $OpenBSD: roa.c,v 1.19 2021/05/11 11:32:51 claudio Exp $ */
 /*
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -366,6 +366,7 @@ roa_parse(X509 **x509, const char *fn)
                warnx("%s: X509_get0_notAfter failed", fn);
                goto out;
        }
+       memset(&expires_tm, 0, sizeof(expires_tm));
        if (ASN1_time_parse(at->data, at->length, &expires_tm, 0) == -1) {
                warnx("%s: ASN1_time_parse failed", fn);
                goto out;