From: David Barksdale Date: Sun, 31 Oct 2010 01:46:15 +0000 (+0000) Subject: Shifting more than the size of the integer is undefined. X-Git-Tag: initial-import-from-subversion-38251~19886 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=54ec9da6272bb80fc9a2ec3bc9f6804fb4c76689;p=oweals%2Fgnunet.git Shifting more than the size of the integer is undefined. --- diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 4ff73395c..5e71ef897 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -3511,7 +3511,11 @@ handle_encrypted_message (struct Neighbour *n, } if (n->last_sequence_number_received < snum) { - n->last_packets_bitmap <<= (snum - n->last_sequence_number_received); + int shift = (snum - n->last_sequence_number_received); + if (shift >= 8 * sizeof(n->last_packets_bitmap)) + n->last_packets_bitmap = 0; + else + n->last_packets_bitmap <<= shift; n->last_sequence_number_received = snum; }