Skip to content

Commit 42d2a67

Browse files
committed
C++: Respond to review comments.
1 parent 4e4ffbd commit 42d2a67

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
char * password = malloc(PASSWORD_SIZE);
2-
// ... read and check password
3-
memset(password, 0, PASSWORD_SIZE);
4-
free(password);
1+
char password[MAX_PASSWORD_LENGTH];
2+
// read and verify password
3+
memset(password, 0, MAX_PASSWORD_LENGTH);
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
char * password = malloc(PASSWORD_SIZE);
2-
// ... read and check password
3-
memset_s(password, PASSWORD_SIZE, 0, PASSWORD_SIZE);
4-
free(password);
1+
char password[MAX_PASSWORD_LENGTH];
2+
// read and verify password
3+
memset_s(password, MAX_PASSWORD_LENGTH, 0, MAX_PASSWORD_LENGTH);

cpp/ql/src/Security/CWE/CWE-014/MemsetMayBeDeleted.qhelp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ longer needed:</p>
3636
CERT C Coding Standard:
3737
<a href="https://wiki.sei.cmu.edu/confluence/display/c/MSC06-C.+Beware+of+compiler+optimizations">MSC06-C. Beware of compiler optimizations</a>.
3838
</li>
39+
<li>
40+
USENIX: The Advanced Computing Systems Association:
41+
<a href="https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-yang.pdf">Dead Store Elimination (Still) Considered Harmfuls</a>
42+
</li>
3943

4044
</references>
4145
</qhelp>

0 commit comments

Comments
 (0)