Date: Fri, 04 Aug 2000 17:31:54 -0400 (EDT) From: Mike Heffner <mheffner@mailandnews.com> To: Kris Kennaway <kris@hub.freebsd.org> Cc: audit@freebsd.org Subject: RE: catopen() patch Message-ID: <XFMail.20000804173154.mheffner@mailandnews.com> In-Reply-To: <Pine.BSF.4.21.0008040128220.66197-100000@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
My PR: misc/16954 is also another method, but I like the idea of setting errno. Also remember manpage would also need patching. On 04-Aug-2000 Kris Kennaway wrote: | Can someone please review the following patch? | | Kris | | Index: msgcat.c | =================================================================== | RCS file: /home/ncvs/src/lib/libc/nls/msgcat.c,v | retrieving revision 1.21 | diff -u -r1.21 msgcat.c | --- msgcat.c 2000/01/27 23:06:33 1.21 | +++ msgcat.c 2000/08/04 08:20:36 | @@ -91,8 +91,9 @@ | __const char *catpath = NULL; | char *nlspath; | char *lang; | - long len; | char *base, *cptr, *pathP; | + int spcleft; | + long len; | struct stat sbuf; | | if (!name || !*name) { | @@ -129,13 +130,20 @@ | *cptr = '\0'; | for (pathP = path; *nlspath; ++nlspath) { | if (*nlspath == '%') { | + spcleft = sizeof(path) - (pathP - path); | if (*(nlspath + 1) == 'L') { | ++nlspath; | - strcpy(pathP, lang); | + if (strlcpy(pathP, lang, spcleft) >= spcleft) { | + errno = ENAMETOOLONG; | + return(NLERR); | + } | pathP += strlen(lang); | } else if (*(nlspath + 1) == 'N') { | ++nlspath; | - strcpy(pathP, name); | + if (strlcpy(pathP, name, spcleft) >= spcleft) { | + errno = ENAMETOOLONG; | + return(NLERR); | + } | pathP += strlen(name); | } else *(pathP++) = *nlspath; | } else *(pathP++) = *nlspath; | | -- | In God we Trust -- all others must submit an X.509 certificate. | -- Charles Forsythe <forsythe@alum.mit.edu> | | | | To Unsubscribe: send mail to majordomo@FreeBSD.org | with "unsubscribe freebsd-audit" in the body of the message -- Mike Heffner <spock@techfour.net> Fredericksburg, 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.20000804173154.mheffner>