Commit 686c0f09 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Even though FC_ENUM16 is an unsigned type, the highest allowable value…

rpcrt4: Even though FC_ENUM16 is an unsigned type, the highest allowable value that can be marshalled is SHRT_MAX, not USHRT_MAX.
parent d8450228
......@@ -5354,7 +5354,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
break;
case RPC_FC_ENUM16:
/* only 16-bits on the wire, so do a sanity check */
if (*(UINT *)pMemory > USHRT_MAX)
if (*(UINT *)pMemory > SHRT_MAX)
RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
*(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory;
......
......@@ -418,8 +418,9 @@ static void test_simple_types(void)
test_pointer_marshal(fmtstr_up_short, &s, 2, wiredata, 6, NULL, 0, "up_short");
test_pointer_marshal(fmtstr_up_ushort, &s, 2, wiredata, 6, NULL, 0, "up_ushort");
i = s;
i = 0x7fff;
*(void**)wiredata = &i;
*(unsigned short*)(wiredata + sizeof(void*)) = i;
test_pointer_marshal(fmtstr_up_enum16, &i, 2, wiredata, 6, NULL, 0, "up_enum16");
l = 0xcafebabe;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment