http://bugs.winehq.org/show_bug.cgi?id=34211
Bug #: 34211 Summary: strncpy C library function doesn't compliant C standard. Product: Wine Version: 1.7.0 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt AssignedTo: wine-bugs@winehq.org ReportedBy: alvaro.nieto@gmail.com Classification: Unclassified
Created attachment 45514 --> http://bugs.winehq.org/attachment.cgi?id=45514 Program that shows the bug and patch that solves it
From standard;
"If the array pointed to by s2 is a string that is shorter than n bytes, null bytes shall be appended to the copy in the array pointed to by s1,until n bytes in all are written"
The attached code doesn't prints anything in Windows and Linux but prints in wine because wine's strncpy doesn't append null bytes.
Also I've included a patch that solves the problem.
http://bugs.winehq.org/show_bug.cgi?id=34211
Alvaro Nieto alvaro.nieto@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alvaro.nieto@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=34211
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, patch, testcase
--- Comment #1 from Austin English austinenglish@gmail.com 2013-08-05 17:32:42 CDT --- Patches should be sent to wine-patches@winehq.org. See http://wiki.winehq.org/SubmittingPatches
http://bugs.winehq.org/show_bug.cgi?id=34211
--- Comment #2 from Bruno Jesus 00cpxxx@gmail.com 2013-08-05 18:46:46 CDT ---
for(i=0; i<sizeof(src); i++) ... for(i=sizeof(src)+1; i<len; i++)
I think you need strlen instead of sizeof, but IMO there seems to be an easier way to do it.
http://bugs.winehq.org/show_bug.cgi?id=34211
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |e3e12845572dce7b35660814c44 | |dedf069de1dfb Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #3 from Bruno Jesus 00cpxxx@gmail.com 2013-08-16 14:43:34 CDT --- Patch commited, thanks for your work.
http://source.winehq.org/git/wine.git/?a=commit;h=e3e12845572dce7b35660814c4...
http://bugs.winehq.org/show_bug.cgi?id=34211
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org 2013-08-30 13:06:10 CDT --- Closing bugs fixed in 1.7.1.
http://bugs.winehq.org/show_bug.cgi?id=34211
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |1.6.x
http://bugs.winehq.org/show_bug.cgi?id=34211
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.6.x |---
--- Comment #5 from Alexandre Julliard julliard@winehq.org 2013-11-15 13:40:31 CST --- Removing 1.6.x milestone from bugs included in 1.6.1.