Check return value of asn1_generalizedtime_to_tm ()
authorcherusker <prince.cherusker@gmail.com>
Sat, 24 Jun 2017 13:03:01 +0000 (15:03 +0200)
committerBernhard Urban <bernhard.urban@xamarin.com>
Mon, 10 Jul 2017 17:05:43 +0000 (19:05 +0200)
mono/btls/btls-util.c

index 955b8c85aec4fa4eea5ae2bc972c0b88bdaa23e4..57fa0fa7813138b5db9ff7422763aa48ac8810d7 100644 (file)
@@ -27,13 +27,19 @@ mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time)
        ASN1_GENERALIZEDTIME *gtime;
        struct tm tm;
        int64_t epoch;
+       int ret;
        
        memset (&tm, 0, sizeof (tm));
 
        gtime = ASN1_TIME_to_generalizedtime (time, NULL);
-       /* FIXME: check return value of  asn1_generalizedtime_to_tm () */
-       asn1_generalizedtime_to_tm (&tm, gtime);
+       ret = asn1_generalizedtime_to_tm (&tm, gtime);
        ASN1_GENERALIZEDTIME_free (gtime);
+
+       /* FIXME: check the return value in managed code */
+       if (ret == 0) {
+               return 0;
+       }
+
        epoch = btls_timegm64 (&tm);
 
        return epoch;