From: <al...@us...> - 2003-04-04 20:09:16
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv4359/modules Modified Files: im_unix.c Log Message: proper string mgmt, even if it's from cmdline Index: im_unix.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_unix.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- im_unix.c 17 Sep 2002 05:20:28 -0000 1.56 +++ im_unix.c 4 Apr 2003 20:09:11 -0000 1.57 @@ -89,7 +89,10 @@ memset(&sunx, 0, sizeof(sunx)); sunx.sun_family = AF_UNIX; - (void)strncpy(sunx.sun_path, logger, sizeof(sunx.sun_path)); + + strncpy(sunx.sun_path, logger, sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof (sunx.sun_path) - 1] = '\0'; + I->im_fd = socket(AF_UNIX, SOCK_DGRAM, 0); if (I->im_fd < 0 || bind(I->im_fd, (struct sockaddr *)&sunx, SUN_LEN(&sunx)) < 0 || |