Date: Wed, 06 Dec 2000 12:56:53 -0500 (EST) From: Mike Heffner <mheffner@vt.edu> To: Chris Faulhaber <jedgar@fxp.org> Cc: freebsd-audit@FreeBSD.org Subject: RE: libutil diff Message-ID: <XFMail.20001206125653.mheffner@vt.edu> In-Reply-To: <20001206105523.A52977@peitho.fxp.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 06-Dec-2000 Chris Faulhaber wrote: | For today's diff, we present libutil: | | - sprintf() -> snprintf() | - do not attempt to manipulate a malloc()'d struct if it is NULL | - strcpy() -> strlcpy() | | I could not find any limits/restrictions on the variables used in | the corrected sprintf()/strcpy() calls, so these seem safer. | [snip] | | Index: pty.c | =================================================================== | RCS file: /home/ncvs/src/lib/libutil/pty.c,v | retrieving revision 1.10 | diff -u -r1.10 pty.c | --- pty.c 1999/08/28 00:05:51 1.10 | +++ pty.c 2000/12/06 15:05:31 | @@ -87,7 +87,7 @@ | *amaster = master; | *aslave = slave; | if (name) | - strcpy(name, line); | + strlcpy(name, line, sizeof(name)); name is a char* passed into the function, so therefore sizeof(name) == 4 The manpage states: If the argument name is not NULL, openpty() copies the pathname of the slave pty to this area. The caller is responsible for allocating the re- quired space in this array. I think it should also mention the length required for name (ie. sizeof(line)). -- Mike Heffner <mheffner@vt.edu> Blacksburg, VA ICQ# 882073 http://my.ispchannel.com/~mheffner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20001206125653.mheffner>