Kaydet (Commit) a463f74e authored tarafından Tor Lillqvist's avatar Tor Lillqvist

WaE: C4723: potential divide by 0

Fix crack that formats an int into eight hex digits. Why the simple
sprintf() that originally was used here was not good enough, but had
to be replaced (in 2009) by broken and hard to understand code I have
no idea.

Found during link-time code generation (!).

Change-Id: I05b33ca0fcb6a47a846ec2ff294243c5639a5b49
üst 9c0ba0ba
......@@ -53,7 +53,7 @@ namespace {
int nInd = 0;
while( nInd < nLen )
{
char nSign = ( nValue / ( 1 << ( ( nLen - nInd ) * 4 ) ) ) % 16;
char nSign = ( nValue / ( 1 << ( ( nLen - nInd - 1 ) * 4 ) ) ) % 16;
if ( nSign >= 0 && nSign <= 9 )
pBuf[nInd] = nSign + '0';
else if ( nSign >= 10 && nSign <= 15 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment