This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/6654] realpath contains off-by-one errors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]