crypt32: Don't assume string pointer has been set if length is 0.

This commit is contained in:
Juan Lang 2007-10-20 14:24:10 -07:00 committed by Alexandre Julliard
parent 7cf611ef3b
commit d34b3bf63c
1 changed files with 6 additions and 2 deletions

View File

@ -913,8 +913,12 @@ static BOOL CRYPT_AsnEncodeBMPString(const CERT_NAME_VALUE *value,
LPCWSTR str = (LPCWSTR)value->Value.pbData;
DWORD bytesNeeded, lenBytes, strLen;
strLen = value->Value.cbData ? value->Value.cbData / sizeof(WCHAR) :
lstrlenW(str);
if (value->Value.cbData)
strLen = value->Value.cbData / sizeof(WCHAR);
else if (value->Value.pbData)
strLen = lstrlenW(str);
else
strLen = 0;
CRYPT_EncodeLen(strLen * 2, NULL, &lenBytes);
bytesNeeded = 1 + lenBytes + strLen * 2;
if (!pbEncoded)