From: Alan T. DeKok Date: Wed, 8 Feb 2012 15:01:43 +0000 (+0100) Subject: strncpy is evil. Don't use it. X-Git-Tag: release_2_2_0~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1ea07cf0e1dcf743c2348d24289a339a2e85730;p=thirdparty%2Ffreeradius-server.git strncpy is evil. Don't use it. --- diff --git a/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c b/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c index 33bbbb339cb..a8531b713d0 100644 --- a/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c +++ b/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c @@ -770,8 +770,7 @@ static int sqlhpwippool_accounting(void *instance, REQUEST *request) } nasip.s_addr = vp->vp_ipaddr; - strncpy(nasipstr, inet_ntoa(nasip), sizeof(nasipstr) - 1); - nasipstr[sizeof(nasipstr)] = 0; + strlcpy(nasipstr, inet_ntoa(nasip), sizeof(nasipstr)); if (!nvp_query(__LINE__, data, sqlsock, "UPDATE `%s`.`ips`, `radacct` "