mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Merge remote-tracking branch 'upstream/master' into mergeback-20181112
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
void* f() {
|
||||
block = malloc(BLOCK_SIZE);
|
||||
block = (MyBlock *)malloc(sizeof(MyBlock));
|
||||
if (block) { //correct: block is checked for nullness here
|
||||
block->id = NORMAL_BLOCK_ID;
|
||||
}
|
||||
//...
|
||||
/* make sure data-portion is null-terminated */
|
||||
block[BLOCK_SIZE - 1] = '\0'; //wrong: block not checked for nullness here
|
||||
block->data[BLOCK_SIZE - 1] = '\0'; //wrong: block not checked for nullness here
|
||||
return block;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
void f(char* string) {
|
||||
// wrong: allocates space for characters, put not zero terminator
|
||||
// wrong: allocates space for characters, but not zero terminator
|
||||
char* buf = malloc(strlen(string));
|
||||
strcpy(buf, string);
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ where // EQExprs are covered by CompareWhereAssignMeant.ql
|
||||
not accessInInitOfForStmt(peivc) and
|
||||
not peivc.isCompilerGenerated() and
|
||||
not exists(Macro m | peivc = m.getAnInvocation().getAnExpandedElement()) and
|
||||
not peivc.isFromTemplateInstantiation(_) and
|
||||
parent = peivc.getParent() and
|
||||
not parent.isInMacroExpansion() and
|
||||
not parent instanceof PureExprInVoidContext and
|
||||
|
||||
Reference in New Issue
Block a user