[PATCH v3] Print absolute paths in printpathn when -yy is used

Zubin Mithra zubin.mithra at gmail.com
Tue Jun 17 06:38:26 UTC 2014


>
> you could use an alloca() buffer starting at a "large enough" value to cover
> most common cases (like 256) and put it into a loop -- when the return value
> of readlink is equal to bufsiz, double the buffer length and try again.

I think there are a few more cases where the call might fail. I tried
creating a path > 4096 in length, and used a readlink call with a
buffer quite larger than the actual path. However, the call still
failed with a "File name too long".

The code I used for testing :
https://gist.github.com/eQu1NoX/69867ae73ded14cb6c9a

Keeping that in mind, would using realloc repeatedly be a good idea?
I've jotted down a bit more about what I tested out here:
http://x86overflow.blogspot.in/2014/05/playing-around-with-getcwd-readpath-and.html.


Thank you!
-- zm




More information about the Strace-devel mailing list