Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2001 23:33:48 -0700 (PDT)
From:      David Xu <davidx@viasoft.com.cn>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/28472: dirname.c basename.c not correctly return ENAMETOOLONG
Message-ID:  <200106280633.f5S6XmE60108@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         28472
>Category:       bin
>Synopsis:       dirname.c basename.c not correctly return ENAMETOOLONG
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 27 23:40:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Xu
>Release:        FreeBSD 4.3-stable
>Organization:
Viasoft
>Environment:
FreeBSD cvs.viasoft.com.cn 4.3-STABLE FreeBSD 4.3-STABLE #0: Wed Jun 20 13:25:45
 CST 2001     root@cvs.viasoft.com.cn:/usr/obj/usr/src/sys/xu  i386
>Description:
libc function basename and dirname missing a condition to return
ENAMETOOLONG

>How-To-Repeat:

>Fix:
--- dirname.c   Thu Jun 28 14:28:37 2001
+++ dirname.c.orig      Thu Jun 28 14:28:25 2001
@@ -69,7 +69,7 @@
                } while (endp > path && *endp == '/');
        }

-       if (endp - path + 1 >= sizeof(bname)) {
+       if (endp - path + 1 > sizeof(bname)) {
                errno = ENAMETOOLONG;
                return(NULL);
        }


--- basename.c  Thu Jun 28 14:24:45 2001
+++ basename.c.orig     Thu Jun 28 14:24:34 2001
@@ -66,7 +66,7 @@
        while (startp > path && *(startp - 1) != '/')
                startp--;

-       if (endp - startp + 1 >= sizeof(bname)) {
+       if (endp - startp + 1 > sizeof(bname)) {
                errno = ENAMETOOLONG;
                return(NULL);
        }


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106280633.f5S6XmE60108>