mirror of https://github.com/FreeRDP/FreeRDP
Fix ASN.1 integer decoding
Treat ASN.1 encoded integers with a leading zero byte and the MSB of the second byte set as non-negative
This commit is contained in:
parent
0fe5831187
commit
9c413abee1
|
@ -1024,13 +1024,20 @@ static size_t WinPrAsn1DecReadIntegerLike(WinPrAsn1Decoder* dec, WinPrAsn1_tag e
|
|||
return 0;
|
||||
|
||||
WinPrAsn1_INTEGER val = 0;
|
||||
for (size_t x = 0; x < len; x++)
|
||||
UINT8 v = 0;
|
||||
|
||||
Stream_Read_UINT8(&dec->source, v);
|
||||
if (v & 0x80)
|
||||
val = 0xFFFFFFFF;
|
||||
val |= v;
|
||||
|
||||
for (size_t x = 1; x < len; x++)
|
||||
{
|
||||
INT8 v = 0;
|
||||
Stream_Read_INT8(&dec->source, v);
|
||||
Stream_Read_UINT8(&dec->source, v);
|
||||
val = (WinPrAsn1_INTEGER)(((UINT32)val) << 8);
|
||||
val |= v;
|
||||
}
|
||||
|
||||
*target = val;
|
||||
ret += len;
|
||||
|
||||
|
|
Loading…
Reference in New Issue