Add comment to integer overflow fix in base64.c

Adds clarifying comment to the integer overflow fix in base64.c
This commit is contained in:
Simon Butcher 2017-02-02 08:46:53 +00:00
parent 59abd301f5
commit 746edf4e75

View File

@ -198,6 +198,10 @@ int base64_decode( unsigned char *dst, size_t *dlen,
return( 0 ); return( 0 );
} }
/* The following expression is to calculate the following formula without
* risk of integer overflow in n:
* n = ( ( n * 6 ) + 7 ) >> 3;
*/
n = ( 6 * ( n >> 3 ) ) + ( ( 6 * ( n & 0x7 ) + 7 ) >> 3 ); n = ( 6 * ( n >> 3 ) ) + ( ( 6 * ( n & 0x7 ) + 7 ) >> 3 );
n -= j; n -= j;