[Bug 211873] lib/libc/gen/basedirname_test:dirname_posix fails: "Input buffer was modified."

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 15 17:24:13 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211873

            Bug ID: 211873
           Summary: lib/libc/gen/basedirname_test:dirname_posix fails:
                    "Input buffer was modified."
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: tests
          Assignee: freebsd-testing at freebsd.org
          Reporter: ngie at FreeBSD.org

Looks like the behavior for dirname(3) on FreeBSD deviates from NetBSD.
Bringing this up because we may or may not want to follow suit.

Assigning to ed@ because he's been heading up the recent basename(3)/dirname(3)
POSIXification.

$ svn info /usr/src/svn/
Path: /usr/src/svn
Working Copy Root Path: /usr/src/svn
URL: svn+ssh://ngie@repo.freebsd.org/base/projects/netbsd-tests-update-12
Relative URL: ^/projects/netbsd-tests-update-12
Repository Root: svn+ssh://ngie@repo.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 304099
Node Kind: directory
Schedule: normal
Last Changed Author: ngie
Last Changed Rev: 304099
Last Changed Date: 2016-08-14 12:54:40 -0700 (Sun, 14 Aug 2016)

$ kyua debug -k lib/libc/gen/Kyuafile basedirname_test:dirname_posix
Input buffer for "/usr/lib" was modified
basedirname_test:dirname_posix  ->  failed: Input buffer was modified.

165                 /*
166                  * dirname(3) is allowed to modify the input buffer.
167                  * However, that is considered hostile by some programs,
168                  * and so we elect to consider this an error.
169                  *
170                  * This is not a problem, as dirname(3) is also allowed
171                  * to return a pointer to a statically-allocated buffer
172                  * (it is explicitly not required to be reentrant).
173                  */
174                 if (test_dirname_table[i].input != NULL &&
175                     strcmp(test_dirname_table[i].input, testbuf) != 0) {
176                         fprintf(stderr,
177                             "Input buffer for \"%s\" was modified\n",
178                             test_dirname_table[i].input);
179                         atf_tc_fail("Input buffer was modified.");
180                 }

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-testing mailing list