mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix regression in packet parser from Aug 19.
* g10/parse-packet.c (parse): Use an int to compare to -1. Use buf32_to_ulong. -- Regression-due-to: 0add91ae1ca3718e8140af09294c595f47c958d3 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
00def10d36
commit
88317ae8c8
@ -558,27 +558,20 @@ parse (IOBUF inp, PACKET * pkt, int onlykeypkts, off_t * retpos,
|
|||||||
else if (c == 255)
|
else if (c == 255)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int eof = 0;
|
|
||||||
char value[4];
|
char value[4];
|
||||||
|
|
||||||
for (i = 0; i < 4; i ++)
|
for (i = 0; i < 4; i ++)
|
||||||
if ((value[i] = hdr[hdrlen++] = iobuf_get (inp)) == -1)
|
|
||||||
{
|
{
|
||||||
eof = 1;
|
if ((c = iobuf_get (inp)) == -1)
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eof)
|
|
||||||
{
|
{
|
||||||
log_error ("%s: 4 byte length invalid\n", iobuf_where (inp));
|
log_error ("%s: 4 byte length invalid\n", iobuf_where (inp));
|
||||||
rc = gpg_error (GPG_ERR_INV_PACKET);
|
rc = gpg_error (GPG_ERR_INV_PACKET);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
value[i] = hdr[hdrlen++] = c;
|
||||||
|
}
|
||||||
|
|
||||||
pktlen = (((unsigned long) value[0] << 24)
|
pktlen = buf32_to_ulong (value);
|
||||||
| ((unsigned long) value[1] << 16)
|
|
||||||
| ((unsigned long) value[2] << 8)
|
|
||||||
| ((unsigned long) value[3]));
|
|
||||||
}
|
}
|
||||||
else /* Partial body length. */
|
else /* Partial body length. */
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user