]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Coverity 709056: Check return value on fputs in tor-gencert
authorNick Mathewson <nickm@torproject.org>
Mon, 16 Jul 2012 15:38:39 +0000 (11:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 16 Jul 2012 15:38:39 +0000 (11:38 -0400)
changes/cov709056 [new file with mode: 0644]
src/tools/tor-gencert.c

diff --git a/changes/cov709056 b/changes/cov709056
new file mode 100644 (file)
index 0000000..64a75ad
--- /dev/null
@@ -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.
+
index a8ffc077963e410b85fea00c09184fb4d5e28951..38b2101a3c44407ea6306ddfa0f290cb02ea55c8 100644 (file)
@@ -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;
 }