]> granicus.if.org Git - fcron/commitdiff
be more secure with str*() : add a \0
authorthib <thib>
Sun, 11 Jul 2004 18:09:41 +0000 (18:09 +0000)
committerthib <thib>
Sun, 11 Jul 2004 18:09:41 +0000 (18:09 +0000)
convert-fcrontab.c

index 8feacb36793a4d0781c0ccb2c2bd2c9b3b9eca45..3af1cbf412c05e060af86953eb2571f15ca3b8c7 100644 (file)
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: convert-fcrontab.c,v 1.18 2003-12-25 22:51:55 thib Exp $ */
+ /* $Id: convert-fcrontab.c,v 1.19 2004-07-11 18:09:41 thib Exp $ */
 
 #include "convert-fcrontab.h"
 #include "global.h"
 
-char rcs_info[] = "$Id: convert-fcrontab.c,v 1.18 2003-12-25 22:51:55 thib Exp $";
+char rcs_info[] = "$Id: convert-fcrontab.c,v 1.19 2004-07-11 18:09:41 thib Exp $";
 
 void info(void);
 void usage(void);
@@ -216,7 +216,8 @@ convert_file(char *file_name)
     /* open a temp file in write mode and truncate it */
     strcpy(buf, "tmp_");
     strncat(buf, file_name, sizeof(buf) - sizeof("tmp_") - 1);
-    
+    buf[sizeof(buf)-1]='\0';
+
     /* everything's ok : we can override the src file safely */
     if ( rename(buf, file_name) != 0 )
        error_e("Could not rename %s to %s", buf, file_name);