[Libreoffice-commits] core.git: xmlsecurity/source

Norbert Thiebaud nthiebaud at gmail.com
Mon Feb 18 15:12:30 PST 2013


 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 21e2c2f16408328f78f418dd9dc086ef2a2a8f19
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Feb 18 04:25:05 2013 -0600

    coverity#982590 Explicit null dereferenced
    
    Change-Id: Ie898603f64a4568a8502caf3db154ae5ce008af9
    Reviewed-on: https://gerrit.libreoffice.org/2227
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 1e7c9c3..988d362 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -279,11 +279,13 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
         if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess )
         {
             xmlsec_trace("Initializing NSS with profile failed.");
-            char * error = NULL;
-
-            PR_GetErrorText(error);
-            if (error)
+            int errlen = PR_GetErrorTextLength();
+            if(errlen > 0)
+            {
+                char error[errlen + 1];
+                PR_GetErrorText(error);
                 xmlsec_trace("%s",error);
+            }
             bSuccess = false;
         }
     }
@@ -294,10 +296,13 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
         if ( NSS_NoDB_Init(NULL) != SECSuccess )
         {
             xmlsec_trace("Initializing NSS without profile failed.");
-            char * error = NULL;
-            PR_GetErrorText(error);
-            if (error)
+            int errlen = PR_GetErrorTextLength();
+            if(errlen > 0)
+            {
+                char error[errlen + 1];
+                PR_GetErrorText(error);
                 xmlsec_trace("%s",error);
+            }
             return false ;
         }
     }


More information about the Libreoffice-commits mailing list