changeset 196:60a70c16d79c noffle

[svn] * src/content.c: When generating temp file to write new content to, make sure there is no possibility of a name clash with an existing file. Bug spotted by Mirko Liss.
author bears
date Tue, 30 Oct 2001 13:55:53 +0000
parents 76460d98b2fb
children 24d4cd032da5
files ChangeLog src/content.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 30 13:16:40 2001 +0000
+++ b/ChangeLog	Tue Oct 30 13:55:53 2001 +0000
@@ -1,3 +1,9 @@
+Tue Oct 30 2001 Jim Hague <jim.hague@acm.org>
+
+* src/content.c: When generating temp file to write new content to, make
+  sure there is no possibility of a name clash with an existing file.
+  Bug spotted by Mirko Liss.
+
 Tue Oct 30 2001 Jim Hague <jim.hague@acm.org>
 
 * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
--- a/src/content.c	Tue Oct 30 13:16:40 2001 +0000
+++ b/src/content.c	Tue Oct 30 13:55:53 2001 +0000
@@ -1,7 +1,7 @@
 /*
   content.c
 
-  $Id: content.c 307 2001-09-12 20:33:44Z bears $
+  $Id: content.c 315 2001-10-30 13:55:53Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -166,6 +166,7 @@
     }
     fclose( f );
 
+
     if ( cont.first == 0 )
 	setupEmpty( name );		/* Corrupt overview file recovery */
     else
@@ -197,8 +198,8 @@
 	return;
     
     /* Save the overview to temporary file in same dir. */
-    snprintf( tmpfname, MAXCHAR, "%s/overview/%s.%d",
-	      Cfg_spoolDir(), cont.name, (int) getpid() ); 
+    snprintf( tmpfname, MAXCHAR, "%s/overview/.#%d.%s",
+	      Cfg_spoolDir(), (int) getpid(), cont.name ); 
     if ( ! ( f = fopen( tmpfname, "w" ) ) )
     {
         Log_err( "Could not open %s for writing", tmpfname );