summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-02-18 04:25:05 -0600
committerMichael Stahl <mstahl@redhat.com>2013-02-18 23:12:09 +0000
commit21e2c2f16408328f78f418dd9dc086ef2a2a8f19 (patch)
tree06f044f2cd931fbdf1090d9e34f5b1005833defe
parent6c89f2e74aa9b202d6d6a41a178ba9aadb2b10e4 (diff)
coverity#982590 Explicit null dereferenced
Change-Id: Ie898603f64a4568a8502caf3db154ae5ce008af9 Reviewed-on: https://gerrit.libreoffice.org/2227 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 1e7c9c39d06e..988d362a6c7b 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 ;
}
}