diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-07-16 11:38:39 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-07-16 11:38:39 -0400 |
commit | d32f5081e1c41324a3464c30c487c6ef57a333d1 (patch) | |
tree | 5d5ea967c21d07c15b4e2712608cf0a7b40fef8d | |
parent | 9ad5b2593004c55d4223d59a150898b48d04737a (diff) | |
download | tor-d32f5081e1c41324a3464c30c487c6ef57a333d1.tar.gz tor-d32f5081e1c41324a3464c30c487c6ef57a333d1.zip |
Coverity 709056: Check return value on fputs in tor-gencert
-rw-r--r-- | changes/cov709056 | 4 | ||||
-rw-r--r-- | src/tools/tor-gencert.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/changes/cov709056 b/changes/cov709056 new file mode 100644 index 0000000000..64a75ad8a2 --- /dev/null +++ b/changes/cov709056 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Check return value of fputs() when writing authority certificate + file. Fixes Coverity issue 709056; bugfix on 0.2.0.1-alpha. + diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c index a8ffc07796..38b2101a3c 100644 --- a/src/tools/tor-gencert.c +++ b/src/tools/tor-gencert.c @@ -497,7 +497,12 @@ generate_certificate(void) return 1; } - fputs(buf, f); + if (fputs(buf, f) < 0) { + log_err(LD_GENERAL, "Couldn't write to %s: %s", + certificate_file, strerror(errno)); + fclose(f); + return 1; + } fclose(f); return 0; } |