[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/src ChangeLog buffer.c commit.c filesubr.c...
From: |
Mark D. Baushke |
Subject: |
[Cvs-cvs] ccvs/src ChangeLog buffer.c commit.c filesubr.c... |
Date: |
Thu, 04 May 2006 14:55:32 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Branch:
Changes by: Mark D. Baushke <address@hidden> 06/05/04 14:55:32
Modified files:
src : ChangeLog buffer.c commit.c filesubr.c import.c
login.c patch.c
Log message:
Merge changes from 1.11.x.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?tr1=1.3391&tr2=1.3392&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/buffer.c.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/commit.c.diff?tr1=1.259&tr2=1.260&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/filesubr.c.diff?tr1=1.107&tr2=1.108&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/import.c.diff?tr1=1.177&tr2=1.178&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/login.c.diff?tr1=1.86&tr2=1.87&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/patch.c.diff?tr1=1.107&tr2=1.108&r1=text&r2=text
Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3391 ccvs/src/ChangeLog:1.3392
--- ccvs/src/ChangeLog:1.3391 Thu May 4 07:52:44 2006
+++ ccvs/src/ChangeLog Thu May 4 14:55:32 2006
@@ -1,5 +1,19 @@
2006-05-04 Mark D. Baushke <address@hidden>
+ * filesubr.c (cvs_temp_file): Avoid keeping pointers to free()'d
+ storage laying around.
+ * commit.c (commit): Handle possible NULL filename values
+ returned from cvs_temp_file().
+ * filesubr.c (cvs_temp_name): Ditto.
+ * import.c (import): Ditto.
+ * login.c (password_entry_operation): Ditto.
+ * logmsg.c (do_verify): Ditto.
+ * patch.c (patch_fileproc): Ditto.
+ [Fixes NetBSD coverity cid-2545.]
+
+ * buffer.c (packetizing_buffer_output): Initialize outdata.
+ [Fixes NetBSD coverity cid-2474.]
+
* server.c (server_updated): Check for NULL return from
findnode_fn(). [Fixes NetBSD coverity cid-1352.]
Index: ccvs/src/buffer.c
diff -u ccvs/src/buffer.c:1.71 ccvs/src/buffer.c:1.72
--- ccvs/src/buffer.c:1.71 Mon Apr 24 18:50:25 2006
+++ ccvs/src/buffer.c Thu May 4 14:55:32 2006
@@ -1667,6 +1667,11 @@
buf_output (pb->buf, outbuf, translated + 2);
else
{
+ /* if ((have + PACKET_SLOP + 4) > BUFFER_DATA_SIZE), then
+ outdata may be NULL. */
+ if (outdata == NULL)
+ abort ();
+
outdata->size = translated + 2;
buf_append_data (pb->buf, outdata, outdata);
}
Index: ccvs/src/commit.c
diff -u ccvs/src/commit.c:1.259 ccvs/src/commit.c:1.260
--- ccvs/src/commit.c:1.259 Mon Apr 24 18:50:26 2006
+++ ccvs/src/commit.c Thu May 4 14:55:32 2006
@@ -653,7 +653,8 @@
fp = cvs_temp_file (&fname);
if (fp == NULL)
- error (1, 0, "cannot create temporary file %s", fname);
+ error (1, 0, "cannot create temporary file %s",
+ fname ? fname : "(null)");
if (fwrite (saved_message, 1, strlen (saved_message), fp)
!= strlen (saved_message))
error (1, errno, "cannot write temporary file %s", fname);
Index: ccvs/src/filesubr.c
diff -u ccvs/src/filesubr.c:1.107 ccvs/src/filesubr.c:1.108
--- ccvs/src/filesubr.c:1.107 Mon Apr 24 18:50:26 2006
+++ ccvs/src/filesubr.c Thu May 4 14:55:32 2006
@@ -783,7 +783,10 @@
}
if (fp == NULL)
+ {
free (fn);
+ fn = NULL;
+ }
/* mkstemp is defined to open mode 0600 using glibc 2.0.7+. There used
* to be a complicated #ifdef checking the library versions here and then
@@ -800,6 +803,11 @@
*/
*filename = fn;
+ if (fn == NULL && fp != NULL)
+ {
+ fclose (fp);
+ fp = NULL;
+ }
return fp;
}
Index: ccvs/src/import.c
diff -u ccvs/src/import.c:1.177 ccvs/src/import.c:1.178
--- ccvs/src/import.c:1.177 Wed Apr 26 03:26:36 2006
+++ ccvs/src/import.c Thu May 4 14:55:32 2006
@@ -356,7 +356,8 @@
/* Create the logfile that will be logged upon completion */
if ((logfp = cvs_temp_file (&tmpfile)) == NULL)
- error (1, errno, "cannot create temporary file `%s'", tmpfile);
+ error (1, errno, "cannot create temporary file `%s'",
+ tmpfile ? tmpfile : "(null)");
/* On systems where we can unlink an open file, do so, so it will go
away no matter how we exit. FIXME-maybe: Should be checking for
errors but I'm not sure which error(s) we get if we are on a system
Index: ccvs/src/login.c
diff -u ccvs/src/login.c:1.86 ccvs/src/login.c:1.87
--- ccvs/src/login.c:1.86 Fri May 13 21:47:28 2005
+++ ccvs/src/login.c Thu May 4 14:55:32 2006
@@ -383,7 +383,8 @@
/* create and open a temp file */
if ((tmp_fp = cvs_temp_file (&tmp_name)) == NULL)
- error (1, errno, "unable to open temp file %s", tmp_name);
+ error (1, errno, "unable to open temp file %s",
+ tmp_name ? tmp_name : "(null)");
line = 0L;
while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
Index: ccvs/src/patch.c
diff -u ccvs/src/patch.c:1.107 ccvs/src/patch.c:1.108
--- ccvs/src/patch.c:1.107 Mon Apr 24 18:50:27 2006
+++ ccvs/src/patch.c Thu May 4 14:55:32 2006
@@ -514,7 +514,8 @@
*/
if ((fp1 = cvs_temp_file (&tmpfile1)) == NULL)
{
- error (0, errno, "cannot create temporary file %s", tmpfile1);
+ error (0, errno, "cannot create temporary file %s",
+ tmpfile1 ? tmpfile1 : "(null)");
ret = 1;
goto out;
}
@@ -523,7 +524,8 @@
error (0, errno, "warning: cannot close %s", tmpfile1);
if ((fp2 = cvs_temp_file (&tmpfile2)) == NULL)
{
- error (0, errno, "cannot create temporary file %s", tmpfile2);
+ error (0, errno, "cannot create temporary file %s",
+ tmpfile2 ? tmpfile2 : "(null)");
ret = 1;
goto out;
}
@@ -532,7 +534,8 @@
error (0, errno, "warning: cannot close %s", tmpfile2);
if ((fp3 = cvs_temp_file (&tmpfile3)) == NULL)
{
- error (0, errno, "cannot create temporary file %s", tmpfile3);
+ error (0, errno, "cannot create temporary file %s",
+ tmpfile3 ? tmpfile3 : "(null)");
ret = 1;
goto out;
}
@@ -732,16 +735,28 @@
free (line1);
if (line2)
free (line2);
- if (CVS_UNLINK (tmpfile1) < 0)
- error (0, errno, "cannot unlink %s", tmpfile1);
- if (CVS_UNLINK (tmpfile2) < 0)
- error (0, errno, "cannot unlink %s", tmpfile2);
- if (CVS_UNLINK (tmpfile3) < 0)
- error (0, errno, "cannot unlink %s", tmpfile3);
- free (tmpfile1);
- free (tmpfile2);
- free (tmpfile3);
- tmpfile1 = tmpfile2 = tmpfile3 = NULL;
+ if (tmpfile1 != NULL)
+ {
+ if (CVS_UNLINK (tmpfile1) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile1);
+ free (tmpfile1);
+ tmpfile1 = NULL;
+ }
+ if (tmpfile2 != NULL)
+ {
+ if (CVS_UNLINK (tmpfile2) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile2);
+ free (tmpfile2);
+ tmpfile2 = NULL;
+ }
+ if (tmpfile3 != NULL)
+ {
+ if (CVS_UNLINK (tmpfile3) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile3);
+ free (tmpfile3);
+ tmpfile3 = NULL;
+ }
+
if (darg_allocated)
{
run_arg_free_p (dargc, dargv);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/src ChangeLog buffer.c commit.c filesubr.c...,
Mark D. Baushke <=