Fix overflow check in oid_get_numeric_string()

(The fix in 791eed3 was wrong.)
This commit is contained in:
Manuel Pégourié-Gonnard 2013-07-15 11:01:14 +02:00 committed by Paul Bakker
parent 4f47538ad8
commit 14d8564402

View file

@ -591,8 +591,7 @@ int oid_get_numeric_string( char *buf, size_t size,
for( i = 1; i < oid->len; i++ )
{
/* Prevent overflow in value. */
unsigned int v = value << 7;
if ( v < value )
if ( ( ( value << 7 ) >> 7 ) != value )
return( POLARSSL_ERR_DEBUG_BUF_TOO_SMALL );
value <<= 7;