mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(esp_event): fix format string vulnerability in esp_event_dump (SEC-064)
fprintf(file, buf) is a format-string sink: if any registered event base or handler name contains "%", fprintf interprets it as a format directive, causing an information leak or crash. Replace with fprintf(file, "%s", buf) so the buffer is always treated as plain text regardless of its content. Closes SEC_064
This commit is contained in:
@@ -1097,7 +1097,7 @@ esp_err_t esp_event_dump(FILE* file)
|
||||
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
||||
|
||||
// Print the contents of the buffer to the file
|
||||
fprintf(file, buf);
|
||||
fprintf(file, "%s", buf);
|
||||
|
||||
// Free the allocated buffer
|
||||
free(buf);
|
||||
|
||||
Reference in New Issue
Block a user