From: thib Date: Sun, 11 Jul 2004 18:08:08 +0000 (+0000) Subject: be more secure with strncat (add \0) X-Git-Tag: ver2_9_5~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e312d30d3db0f119ca04f3da88e6e3b81bc99042;p=fcron be more secure with strncat (add \0) --- diff --git a/fileconf.c b/fileconf.c index dc99d55..129c8b4 100644 --- a/fileconf.c +++ b/fileconf.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fileconf.c,v 1.73 2004-04-29 19:29:36 thib Exp $ */ + /* $Id: fileconf.c,v 1.74 2004-07-11 18:08:08 thib Exp $ */ #include "fcrontab.h" @@ -341,7 +341,10 @@ read_env(char *ptr, cf_t *cf) Alloc(env, env_t); strncat(name, "=", sizeof(name) - strlen(name) - 1); - env->e_val = strdup2( strncat(name,val,sizeof(name)-strlen(name)-1) ); + name[sizeof(name)-1]='\0'; + strncat(name,val,sizeof(name)-strlen(name)-1); + name[sizeof(name)-1]='\0'; + env->e_val = strdup2( name ); env->e_next = cf->cf_env_base; cf->cf_env_base = env; }