crypt32: Fix CryptBinaryToString return value on short base64 buffer.
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6cbedfa65b
commit
e0708d0601
|
@ -240,7 +240,7 @@ static BOOL BinaryToBase64A(const BYTE *pbBinary,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pcchString = charsNeeded;
|
*pcchString = charsNeeded;
|
||||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
SetLastError(ERROR_MORE_DATA);
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pcchString = charsNeeded;
|
*pcchString = charsNeeded;
|
||||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
SetLastError(ERROR_MORE_DATA);
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,6 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
|
||||||
strLen2 = strLen - 1;
|
strLen2 = strLen - 1;
|
||||||
str[0] = 0x12;
|
str[0] = 0x12;
|
||||||
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
|
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
|
||||||
todo_wine
|
|
||||||
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringA failed %d, error %d.\n",
|
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringA failed %d, error %d.\n",
|
||||||
ret, GetLastError());
|
ret, GetLastError());
|
||||||
ok(strLen2 == strLen || broken(strLen2 == strLen - 1), "Expected length %d, got %d\n", strLen, strLen2);
|
ok(strLen2 == strLen || broken(strLen2 == strLen - 1), "Expected length %d, got %d\n", strLen, strLen2);
|
||||||
|
@ -207,7 +206,6 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO
|
||||||
strLen2 = strLen - 1;
|
strLen2 = strLen - 1;
|
||||||
strW[0] = 0x1234;
|
strW[0] = 0x1234;
|
||||||
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
|
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
|
||||||
todo_wine
|
|
||||||
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringW failed, %d, error %d\n",
|
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringW failed, %d, error %d\n",
|
||||||
ret, GetLastError());
|
ret, GetLastError());
|
||||||
if (headerW)
|
if (headerW)
|
||||||
|
|
Loading…
Reference in New Issue