提交 0e7bda79 编写于 作者: D Dr. Stephen Henson

Handle BER length encoding.

Tolerate BER length encoding which may include leading zeroes.

PR#2746
上级 a356e488
......@@ -170,14 +170,20 @@ static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max
i= *p&0x7f;
if (*(p++) & 0x80)
{
if (max < (int)i)
return 0;
/* Skip leading zeroes */
while (i && *p == 0)
{
p++;
i--;
}
if (i > sizeof(long))
return 0;
if (max-- == 0) return(0);
while (i-- > 0)
{
ret<<=8L;
ret|= *(p++);
if (max-- == 0) return(0);
}
}
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册