[xmlsec] possible NULLs - Clang complains (Simo Sorce, Red Hat)



commit 9a260eae28260d733cb6358808d866403697f51f
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Wed Jun 4 09:56:24 2014 -0700

    possible NULLs - Clang complains (Simo Sorce, Red Hat)

 src/nss/keysstore.c |    2 +-
 src/nss/x509vfy.c   |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/nss/keysstore.c b/src/nss/keysstore.c
index f07e44b..057fc45 100644
--- a/src/nss/keysstore.c
+++ b/src/nss/keysstore.c
@@ -271,7 +271,7 @@ xmlSecNssKeysStoreInitialize(xmlSecKeyStorePtr store) {
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecNssKeysStoreId), -1);
 
     ss = xmlSecNssKeysStoreGetSS(store);
-    xmlSecAssert2((*ss == NULL), -1);
+    xmlSecAssert2(((ss == NULL) || (*ss == NULL)), -1);
 
     *ss = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
     if(*ss == NULL) {
diff --git a/src/nss/x509vfy.c b/src/nss/x509vfy.c
index fecf4ae..54edff9 100644
--- a/src/nss/x509vfy.c
+++ b/src/nss/x509vfy.c
@@ -233,7 +233,8 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
                         NULL,
                         XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,
                         "cert with subject name %s could not be verified because the issuer's cert is 
expired/invalid or not found",
-                        cert->subjectName);
+                        (cert != NULL) ? cert->subjectName : "(NULL)"
+            );
             break;
         case SEC_ERROR_EXPIRED_CERTIFICATE:
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -241,23 +242,25 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
                         NULL,
                         XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,
                         "cert with subject name %s has expired",
-                        cert->subjectName);
-            break;
+                        (cert != NULL) ? cert->subjectName : "(NULL)"
+                       );
+                       break;
         case SEC_ERROR_REVOKED_CERTIFICATE:
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_REVOKED,
                         "cert with subject name %s has been revoked",
-                        cert->subjectName);
-            break;
+                        (cert != NULL) ? cert->subjectName : "(NULL)"
+                       );
+                       break;
         default:
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,
-                                                "cert with subject name %s could not be verified, errcode 
%d",
-                                                cert->subjectName,
+                        "cert with subject name %s could not be verified, errcode %d",
+                        (cert != NULL) ? cert->subjectName : "(NULL)",
                         PORT_GetError());
             break;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]