Otherwise, the function allocates a heap memory when prev_size is enough. What is worse is that it returns the buffer untouched if the prev_size is insufficient.
From: Akihiro Sagawa sagawa.aki@gmail.com
Otherwise, the function allocates a heap memory when prev_size is enough. What is worse is that it returns the buffer untouched if the prev_size is insufficient.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53703 --- dlls/user32/winproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 2ca802e647a..6cd41b51435 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -747,7 +747,8 @@ void dispatch_win_proc_params( struct win_proc_params *params ) /* make sure that there is space for 'size' bytes in buffer, growing it if needed */ static inline void *get_buffer_space( void **buffer, size_t size, size_t prev_size ) { - if (prev_size > size && !(*buffer = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL; + if (prev_size < size) + *buffer = HeapAlloc( GetProcessHeap(), 0, size ); return *buffer; }
This merge request was approved by Jacek Caban.