On Thu, 17 Jan 2002, Uwe Bonnes wrote:
"Medland," == Medland, Bill <Bill.Medland(a)accpac.com> writes:
Medland,> Bill Medland (medbi01(a)accpac.com) Prevent trying to handle Medland,> uninitialised memory as a string.
Medland,> Index: wine/loader/module.c Medland,> =================================================================== Medland,> RCS file: /home/wine/wine/loader/module.c,v retrieving Medland,> revision 1.144 diff -u -r1.144 module.c --- Medland,> wine/loader/module.c 2001/12/20 00:19:42 1.144 +++ Medland,> wine/loader/module.c 2002/01/17 13:45:52 @@ -1379,6 +1379,7 @@
Medland,> filename = HeapAlloc ( GetProcessHeap(), 0, MAX_PATH + 1 ); Medland,> if ( !filename ) return NULL; Medland,> + *filename = 0; /* Just in case
Wouldn't HEAP_ZERO_MEMORY be a better argument to HeapAlloc then 0?
I like the '*filename = 0' solution better as HEAP_ZERO_MEMORY would overinitialize the buffer (wasting CPU time and memory bandwidth). In fact I would like the following even better :-) *filename = '\0'; (assuming filename is a char*) But that's just a question of style. -- Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/ Broadcast message : fin du monde dans cinq minutes, repentez vous !