mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-04 20:38:50 +01:00
gpg: Fix possible read of unallocated memory
* g10/parse-packet.c (can_handle_critical): Check content length before calling can_handle_critical_notation. -- The problem was found by Jan Bee and gniibe proposed the used fix. Thanks. This bug can't be exploited: Only if the announced length of the notation is 21 or 32 a memcmp against fixed strings using that length would be done. The compared data is followed by the actual signature and thus it is highly likely that not even read of unallocated memory will happen. Nevertheless such a bug needs to be fixed. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d92fe965f3
commit
d2b0e61313
@ -1196,9 +1196,12 @@ can_handle_critical( const byte *buffer, size_t n, int type )
|
||||
switch( type )
|
||||
{
|
||||
case SIGSUBPKT_NOTATION:
|
||||
if(n>=8)
|
||||
return can_handle_critical_notation(buffer+8,(buffer[4]<<8)|buffer[5]);
|
||||
else
|
||||
if (n >= 8)
|
||||
{
|
||||
size_t notation_len = ((buffer[4] << 8) | buffer[5]);
|
||||
if (n - 8 >= notation_len)
|
||||
return can_handle_critical_notation (buffer + 8, notation_len);
|
||||
}
|
||||
return 0;
|
||||
case SIGSUBPKT_SIGNATURE:
|
||||
case SIGSUBPKT_SIG_CREATED:
|
||||
|
Loading…
Reference in New Issue
Block a user