From owner-freebsd-audit Fri Aug 4 14:33:44 2000 Delivered-To: freebsd-audit@freebsd.org Received: from smtp1a.ispchannel.com (smtp.ispchannel.com [24.142.63.7]) by hub.freebsd.org (Postfix) with ESMTP id 2319537BDD8 for ; Fri, 4 Aug 2000 14:33:37 -0700 (PDT) (envelope-from mheffner@mailandnews.com) Received: from muriel.penguinpowered.com ([208.138.198.109]) by smtp1a.ispchannel.com (InterMail vK.4.02.00.00 201-232-116 license 7d3764cdaca754bf8ae20adf0db2aa60) with ESMTP id <20000804213521.THFZ8223.smtp1a@muriel.penguinpowered.com>; Fri, 4 Aug 2000 14:35:21 -0700 Content-Length: 2306 Message-ID: X-Mailer: XFMail 1.4.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Fri, 04 Aug 2000 17:31:54 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Kris Kennaway Subject: RE: catopen() patch Cc: audit@freebsd.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 | | | | To Unsubscribe: send mail to majordomo@FreeBSD.org | with "unsubscribe freebsd-audit" in the body of the message -- Mike Heffner 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