mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +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:
@@ -1152,7 +1152,7 @@ esp_err_t esp_event_dump(FILE* file)
|
|||||||
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
||||||
|
|
||||||
// Print the contents of the buffer to the file
|
// Print the contents of the buffer to the file
|
||||||
fprintf(file, buf);
|
fprintf(file, "%s", buf);
|
||||||
|
|
||||||
// Free the allocated buffer
|
// Free the allocated buffer
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user