coverity#982462 Dereference after null check

Change-Id: I5e90d51440afa4e317bc07ccb937f606edbc9eb9
This commit is contained in:
Caolán McNamara
2014-06-12 09:57:18 +01:00
parent a84fca9a0a
commit 2489589a64

View File

@@ -147,13 +147,16 @@ cpyBootstrapSocketPath(sal_Char *name, size_t len)
if (rtl_bootstrap_get(pName, &pValue, NULL)) if (rtl_bootstrap_get(pName, &pValue, NULL))
{ {
rtl_String *pStrValue = 0;
if (pValue && pValue->length > 0) if (pValue && pValue->length > 0)
{ {
rtl_String *pStrValue = 0;
rtl_uString2String(&pStrValue, pValue->buffer, rtl_uString2String(&pStrValue, pValue->buffer,
pValue->length, RTL_TEXTENCODING_UTF8, pValue->length, RTL_TEXTENCODING_UTF8,
OUSTRING_TO_OSTRING_CVTFLAGS); OUSTRING_TO_OSTRING_CVTFLAGS);
if (pStrValue && pStrValue->length > 0) if (pStrValue)
{
if (pStrValue->length > 0)
{ {
size_t nCopy = (len-1 < (size_t)pStrValue->length) ? len-1 : (size_t)pStrValue->length; size_t nCopy = (len-1 < (size_t)pStrValue->length) ? len-1 : (size_t)pStrValue->length;
strncpy (name, pStrValue->buffer, nCopy); strncpy (name, pStrValue->buffer, nCopy);
@@ -162,6 +165,7 @@ cpyBootstrapSocketPath(sal_Char *name, size_t len)
} }
rtl_string_release(pStrValue); rtl_string_release(pStrValue);
} }
}
rtl_uString_release(pName); rtl_uString_release(pName);
} }
return bRet; return bRet;