From: Arran Cudbard-Bell Date: Sun, 17 Feb 2013 19:40:56 +0000 (-0500) Subject: Fix for coverity (printf of non null terminated string) X-Git-Tag: release_3_0_0_beta1~1076 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=098e1103ec3f7b3f161aa13deaefcf5d38e74aba;p=thirdparty%2Ffreeradius-server.git Fix for coverity (printf of non null terminated string) --- diff --git a/src/main/radwho.c b/src/main/radwho.c index 18e701ab090..4115e124730 100644 --- a/src/main/radwho.c +++ b/src/main/radwho.c @@ -487,7 +487,7 @@ int main(int argc, char **argv) */ while (fread(&rt, sizeof(rt), 1, fp) == 1) { if (rt.type != P_LOGIN) continue; /* hide logout sessions */ - + /* * We don't show shell users if we are * fingerd, as we have done that above. @@ -600,8 +600,11 @@ int main(int argc, char **argv) * Show the fill name, or not. */ if (showname) { + char login[sizeof(rt.login) + 1]; + strncpy(login, rt.login, sizeof(rt.login)); + printf((rawoutput == 0? rfmt1: rfmt1r), - rt.login, + login, showcid ? rt.caller_id : (showsid? session_id : fullname(rt.login)), proto(rt.proto, rt.porttype),