mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
common: Use iobuf_get_noeof to avoid undefined behaviors.
* common/iobuf.c (block_filter): Use iobuf_get_noeof. -- When singed integer has negative value, left shift computation is undefined in C. GnuPG-bug-id: 4093 Reported-by: Philippe Antoine Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
adce73b86f
commit
f80346f42d
@ -878,9 +878,9 @@ block_filter (void *opaque, int control, iobuf_t chain, byte * buffer,
|
||||
}
|
||||
else if (c == 255)
|
||||
{
|
||||
a->size = (size_t)iobuf_get (chain) << 24;
|
||||
a->size |= iobuf_get (chain) << 16;
|
||||
a->size |= iobuf_get (chain) << 8;
|
||||
a->size = iobuf_get_noeof (chain) << 24;
|
||||
a->size |= iobuf_get_noeof (chain) << 16;
|
||||
a->size |= iobuf_get_noeof (chain) << 8;
|
||||
if ((c = iobuf_get (chain)) == -1)
|
||||
{
|
||||
log_error ("block_filter: invalid 4 byte length\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user