summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/cov7090564
-rw-r--r--src/tools/tor-gencert.c7
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;
}