Re: Misc bugs found by using valgrind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexandre Julliard <julliard@winehq.org> writes:

> MichaelGuennewig@gmx.de (Michael Günnewig) writes:
>
>> It's a point, so here is the new patch.
>
> I don't think we need to check string sizes against MAXINT, that's
> just a waste of time.

Okay you're correct, the check isn't necessary as MAXINT * 2 is
MAXUINT - 1 and the size parameter of GlobalAlloc is unsigned.

But the * sizeof(WCHAR) in the GlobalAlloc call is necessary to avoid
possible memory corruption because of buffer overruns. So here is it.

  Michael

--- dlls/avifil32/api.c.SAV     2003-09-20 16:14:45.000000000 +0200
+++ dlls/avifil32/api.c 2003-10-03 00:54:11.000000000 +0200
@@ -1009,2 +1009,2 @@
   szFilter[0] = 0;
   szFilter[1] = 0;

-  wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter);
+  wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter * sizeof(WCHAR));
   if (wszFilter == NULL)
     return AVIERR_MEMORY;


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux