Skip to content

Commit 3370902

Browse files
emma592lacraig2
authored andcommitted
Prevent usage of uninitialized mem_buffer
Check at line 186 (if (strlen(mem_buffer) > 0)) is not true if the malloc-ed data is not zero, resulting in broken traces.
1 parent 0385009 commit 3370902

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

panda/plugins/trace/trace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ bool init_plugin(void *self) {
283283
assert(init_osi_api());
284284
}
285285

286-
mem_buffer = (char*) malloc(MEM_BUF_SIZE);
286+
mem_buffer = (char*) calloc(1, MEM_BUF_SIZE);
287287
if (mem_buffer == NULL) {
288288
perror("malloc");
289289
return false;

0 commit comments

Comments
 (0)