https://bugs.winehq.org/show_bug.cgi?id=39988
Bug ID: 39988 Summary: winepath -w wrong output with path longer 260 Product: Wine Version: 1.9.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: s3141p@gmail.com Distribution: ---
When the input $pathname is longer than 260 characters wine -w $pathname 1. truncates the converted output path at 260 characters 2. appends some garbage characters to it 3. reports no error and exits with status 0
I think fixing #3 as a minimum is important; at least exit 1, possibly print an error message.
Fixing #2? Why is it printing garbage characters? Buffer overrun?
And please consider changing #1 by extending support to paths > 260 characters. After all, if I convert the same path by hand and feed it to a Windows application it has no problems dealing with it. So the 260-character limit of winepath -w seems rather artificial to me.
I create long linux paths with mkdir -p /tmp/aaa/bbb/ccc/ddd/eee/ touch /tmp/aaa/bbb/ccc/ddd/eee/$(dd if=/dev/zero count=1 bs=260 | tr '\000' a) # which creates /tmp/aaa/bbb/ccc/ddd/eee/aaaaaaaa...
Thanks.
https://bugs.winehq.org/show_bug.cgi?id=39988
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #1 from winetest@luukku.com --- I was looking for wine source code with keyword MAX_PATH I did find lots of hits, but I was unable to find the value. On the other hand I found maxpathlen or something similar and it was limited to 256. Assuming that it's because of some buffer overflow.
https://bugs.winehq.org/show_bug.cgi?id=39988
--- Comment #2 from winetest@luukku.com --- According to another bug report MAX_PATH has a value of 260. I think it's hard coded like that all over the place.
Even adding if condition check would help here. The question is that where to start looking the source code?
https://bugs.winehq.org/show_bug.cgi?id=39988
--- Comment #3 from winetest@luukku.com --- Maybe wine should allocate everytime a new buffer when a / mark is used for a path name until the whole path is allocated.