Merge pull request #1164 from ChrisGuzak/ChrisGuzak-sizeof-not_max

use sizeof(buffer) instead of MAX
pull/1170/head
Gabriel Dos Reis 8 years ago committed by GitHub
commit 644e0f5b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1584,7 +1584,7 @@ Consider a famous security bug:
{
char buffer[MAX];
// ...
memset(buffer, 0, MAX);
memset(buffer, 0, sizeof(buffer));
}
There was no postcondition stating that the buffer should be cleared and the optimizer eliminated the apparently redundant `memset()` call:
@ -1593,7 +1593,7 @@ There was no postcondition stating that the buffer should be cleared and the opt
{
char buffer[MAX];
// ...
memset(buffer, 0, MAX);
memset(buffer, 0, sizeof(buffer));
Ensures(buffer[0] == 0);
}

Loading…
Cancel
Save