From 23e5ad0c19123f2265e35497115c3c6f66bfbd5b Mon Sep 17 00:00:00 2001 From: thib Date: Sun, 11 Jul 2004 18:09:41 +0000 Subject: [PATCH] be more secure with str*() : add a \0 --- convert-fcrontab.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/convert-fcrontab.c b/convert-fcrontab.c index 8feacb3..3af1cbf 100644 --- a/convert-fcrontab.c +++ b/convert-fcrontab.c @@ -22,12 +22,12 @@ * `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); -- 2.40.0