Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
../../../../github/wayfire/wayfire.git/src/debug.cpp: In function ‘std::string read_output(std::string)’: ../../../../github/wayfire/wayfire.git/src/debug.cpp:95:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 95 | fgets(buffer, MAX_FUNCTION_NAME, file); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this case there is a potential problem: if gets returns NULL, then nothing was read and the buffer is uninitialized. Not only would this function be returning uninitialized data, an arbitrary amount of memory could be allocated into line (and be returned) when std::string line = buffer; is searching for a terminating zero in the uninitialized buffer.
- Loading branch information