Commit 80e8fdbe authored by Benjamin Kaduk's avatar Benjamin Kaduk Committed by Rich Salz
Browse files

CT: check some GeneralizedTime return values



Some of the ASN.1 routines for the GeneralizedTime type can return
errors; check for these and do not continue past failure, so as
to appease coverity.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent b805b444
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ static void timestamp_print(uint64_t timestamp, BIO *out)
    ASN1_GENERALIZEDTIME *gen = ASN1_GENERALIZEDTIME_new();
    char genstr[20];

    if (gen == NULL)
        return;
    ASN1_GENERALIZEDTIME_adj(gen, (time_t)0,
                             (int)(timestamp / 86400000),
                             (timestamp % 86400000) / 1000);
@@ -89,7 +91,7 @@ static void timestamp_print(uint64_t timestamp, BIO *out)
     */
    BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ",
                 ASN1_STRING_data(gen), (unsigned int)(timestamp % 1000));
    ASN1_GENERALIZEDTIME_set_string(gen, genstr);
    if (ASN1_GENERALIZEDTIME_set_string(gen, genstr))
        ASN1_GENERALIZEDTIME_print(out, gen);
    ASN1_GENERALIZEDTIME_free(gen);
}