Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Aug 2000 22:32:22 -0700 (PDT)
From:      Kris Kennaway <kris@FreeBSD.org>
To:        Mike Heffner <spock@techfour.net>
Cc:        Kris Kennaway <kris@hub.freebsd.org>, audit@freebsd.org
Subject:   RE: catopen() patch
Message-ID:  <Pine.BSF.4.21.0008062231250.6484-100000@freefall.freebsd.org>
In-Reply-To: <XFMail.20000805182805.mheffner@mailandnews.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 5 Aug 2000, Mike Heffner wrote:

> We can still walk right off the end.

Right you are! This isn't such a big deal since $NLSPATH isn't read if
we;re setugid, but how does this patch look (relative to the one I
already committed):

Index: msgcat.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/nls/msgcat.c,v
retrieving revision 1.22
diff -u -r1.22 msgcat.c
--- msgcat.c	2000/08/05 04:56:43	1.22
+++ msgcat.c	2000/08/07 05:28:46
@@ -124,13 +124,14 @@
 	strcpy(cptr, nlspath);
 	cptr[len] = ':';
 	cptr[len+1] = '\0';
+	spcleft = sizeof(path);
 
 	for (nlspath = cptr; *cptr; ++cptr) {
 	    if (*cptr == ':') {
 		*cptr = '\0';
-		for (pathP = path; *nlspath; ++nlspath) {
+		for (pathP = path; *nlspath && spcleft > 0; ++nlspath) {
+		    spcleft = sizeof(path) - (pathP - path);
 		    if (*nlspath == '%') {
-		        spcleft = sizeof(path) - (pathP - path);
 			if (*(nlspath + 1) == 'L') {
 			    ++nlspath;
 			    if (strlcpy(pathP, lang, spcleft) >= spcleft) {

Kris

--
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008062231250.6484-100000>