]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added checks to avoid false negatives reported by static analyzers
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 9 Nov 2018 19:11:42 +0000 (20:11 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 10 Nov 2018 06:20:13 +0000 (07:20 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/x509/dn.c
lib/x509/x509.c

index 07b9d94b6b74f80e23fa71f17cbe0c57f3029052..828bd9059de70db2f55c601dc9d3f3efeaf476ba 100644 (file)
@@ -286,6 +286,8 @@ _gnutls_x509_parse_dn(ASN1_TYPE asn1_struct,
                goto cleanup;
        }
 
+       assert(dn.data != NULL);
+
        if (buf) {
                memcpy(buf, dn.data, dn.size);
                buf[dn.size] = 0;
index 1880f6acc3d61184100c4b590279f239c3de954c..6fe6cd91c38899a13ebb6b7a02d9df336c9d41d1 100644 (file)
@@ -154,6 +154,9 @@ gnutls_x509_crt_equals2(gnutls_x509_crt_t cert1,
 {
        bool result;
 
+       if (cert1 == NULL || der == NULL)
+               return 0;
+
        if (cert1->der.size == 0 || cert1->modified) {
                gnutls_datum_t tmp1;
                int ret;
@@ -4196,8 +4199,10 @@ void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt,
                                      gnutls_pin_callback_t fn,
                                      void *userdata)
 {
-       crt->pin.cb = fn;
-       crt->pin.data = userdata;
+       if (crt) {
+               crt->pin.cb = fn;
+               crt->pin.data = userdata;
+       }
 }
 
 /**