public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6654] New: realpath contains off-by-one errors
@ 2008-06-18 13:10 john at calva dot com
  2008-06-25 13:04 ` [Bug libc/6654] " halesh dot sadashiv at ap dot sony dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: john at calva dot com @ 2008-06-18 13:10 UTC (permalink / raw)
  To: glibc-bugs

In realpath (stdlib/canonicalize.c) we have:

#ifdef PATH_MAX
  path_max = PATH_MAX;
#else
  path_max = pathconf (name, _PC_PATH_MAX);
  if (path_max <= 0)
    path_max = 1024;
#endif
[...]
              char *buf = __alloca (path_max);
[...]
              n = __readlink (rpath, buf, path_max);
              if (n < 0)
                goto error;
              buf[n] = '\0';

readlink would be quite happy to fill all path_max bytes of buf, returning
path_max as n, then we'll write into buf[path_max] which is one byte beyond the
allocated space.

Need either +1 on the alloca or -1 on the readlink.

-- 
           Summary: realpath contains off-by-one errors
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: john at calva dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6654

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <bug-6654-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-07-04  6:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-18 13:10 [Bug libc/6654] New: realpath contains off-by-one errors john at calva dot com
2008-06-25 13:04 ` [Bug libc/6654] " halesh dot sadashiv at ap dot sony dot com
2008-06-25 13:05 ` halesh dot sadashiv at ap dot sony dot com
2008-06-25 13:05 ` halesh dot sadashiv at ap dot sony dot com
2008-06-25 13:06 ` halesh dot sadashiv at ap dot sony dot com
2008-06-25 13:31 ` halesh dot sadashiv at ap dot sony dot com
2008-06-26  0:02 ` drepper at redhat dot com
2008-06-26  7:51 ` john at calva dot com
     [not found] <bug-6654-131@http.sourceware.org/bugzilla/>
2014-07-04  6:54 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).