2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Properly check against errors against fwrite

fwrite is not the same as write; you have to explicitly compare against the length to detect errors, and sometimes number of items is mistaken for length.
This commit is contained in:
Rose
2025-06-17 13:44:54 -04:00
committed by Todd C. Miller
parent e6cf241b03
commit 5fad16bda2
4 changed files with 8 additions and 8 deletions

View File

@@ -51,7 +51,7 @@ fwriteall(const char *file_path, const char *string)
goto cleanup;
size_t size = strlen(string);
if (fwrite(string, 1, size, file) < size) {
if (fwrite(string, 1, size, file) != size) {
goto cleanup;
}