mirror of
https://github.com/github/codeql.git
synced 2025-12-24 20:56:33 +01:00
11 lines
306 B
C++
11 lines
306 B
C++
void* f() {
|
|
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->data[BLOCK_SIZE - 1] = '\0'; //wrong: block not checked for nullness here
|
|
return block;
|
|
}
|