This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/6654] realpath contains off-by-one errors
- From: "halesh dot sadashiv at ap dot sony dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 25 Jun 2008 13:03:22 -0000
- Subject: [Bug libc/6654] realpath contains off-by-one errors
- References: <20080618130922.6654.john@calva.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From halesh dot sadashiv at ap dot sony dot com 2008-06-25 13:03 -------
Created an attachment (id=2795)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=2795&action=view)
Testcase to verify the problem in __realpath()
Hi,
Even though the raised defect occurs in realtime hardly, I have tried
to prove with small testcode.
By executing the attached testcase I found the o/p like this
$ ./test_realpath
Softlinked file before calling realpath: lfile
Actual_path got from realpath /home/halesh/simple.exp.t
Softlinked file after calling realpath:
After calling the realpath() API, the varibale which had softlink file
name will get currupted because of overwriting '\0' in __realpath()
of stdlib/canonicalize.c
char*
__realpath (const char *name, char *resolved)
{
[...]
n = __readlink (rpath, buf, path_max);
if (n < 0)
goto error;
buf[n] = '\0';
[...]
}
After applaying the patch..the o/p was proper
$ ./test_realpath
Softlinked file before calling realpath: lfile
Actual_path got from realpath /home/halesh/simple.exp.
Softlinked file after calling realpath: lfile
If any comments please let me know.
--
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.