rpcrt4: Even though FC_ENUM16 is an unsigned type, the highest allowable value that can be marshalled is SHRT_MAX, not USHRT_MAX.
This commit is contained in:
parent
d845022819
commit
686c0f094c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue