From 20d8ad9793562a42ac35c67fb41123875aa8009d Mon Sep 17 00:00:00 2001 From: Frederic Marchal Date: Sun, 7 Jun 2015 21:08:11 +0200 Subject: [PATCH] Add a limit on the size of some string generated with sprintf This is to avoid a buffer overflow. --- useragent.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/useragent.c b/useragent.c index 8d649d4..015024b 100644 --- a/useragent.c +++ b/useragent.c @@ -63,9 +63,8 @@ void useragent(void) ipbefore[0]='\0'; namebefore[0]='\0'; - sprintf(tmp3,"%s/squagent.int_unsort",tmp); - sprintf(tmp2,"%s/squagent.int_log",tmp); - + snprintf(tmp3,sizeof(tmp3),"%s/squagent.int_unsort",tmp); + snprintf(tmp2,sizeof(tmp2),"%s/squagent.int_log",tmp); if((fp_ou=fopen(tmp3,"w"))==NULL) { debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno)); -- 2.47.2