gdiplus: in GdipDrawString only NULL terminate if we have room in the buffer.
Nikolay Sivov
bunglehead at gmail.com
Thu Feb 12 11:49:14 CST 2009
Aric Stewart wrote:
> ---
> dlls/gdiplus/graphics.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
> index 2673042..c276a43 100644
> --- a/dlls/gdiplus/graphics.c
> +++ b/dlls/gdiplus/graphics.c
> @@ -1901,7 +1901,8 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
> j++;
> }
>
> - stringdup[j] = 0;
> + if (j < length)
> + stringdup[j] = 0;
> length = j;
>
> while(sum < length){
>
Hm, maybe I don't follow something, but I think 'j < length' is always
true after that:
---
for(i = 0, j = 0; i < length; i++){
if(!isprintW(string[i]) && (string[i] != '\n'))
continue;
stringdup[j] = string[i];
j++;
}
stringdup[j] = 0;
length = j;
---
Or you thought about zero length case? It should be handled earlier, on
stringdup allocation or before...
More information about the wine-devel
mailing list