Fix portability issue in oid_get_numeric_string()

This commit is contained in:
Manuel Pégourié-Gonnard 2013-07-09 16:26:08 +02:00
parent de44a4aecf
commit 791eed3f33

View file

@ -33,7 +33,6 @@
#include "polarssl/rsa.h" #include "polarssl/rsa.h"
#include <stdio.h> #include <stdio.h>
#include <limits.h>
/* /*
* Macro to generate an internal function for oid_XXX_from_asn1() (used by * Macro to generate an internal function for oid_XXX_from_asn1() (used by
@ -572,7 +571,8 @@ int oid_get_numeric_string( char *buf, size_t size,
for( i = 1; i < oid->len; i++ ) for( i = 1; i < oid->len; i++ )
{ {
/* Prevent overflow in value. */ /* Prevent overflow in value. */
if (value > (UINT_MAX >> 7) ) unsigned int v = value << 7;
if ( v < value )
return( POLARSSL_ERR_DEBUG_BUF_TOO_SMALL ); return( POLARSSL_ERR_DEBUG_BUF_TOO_SMALL );
value <<= 7; value <<= 7;