[PATCH] use a better size to lstrcpynW

Alexandre Julliard julliard at winehq.org
Fri Dec 14 07:04:36 CST 2007


Marcus Meissner <meissner at suse.de> writes:

> -        lstrcpynW( num, begin + 1, end - begin );
> -        begin += end - begin + 1;
> +
> +        xcnt =  end - begin;
> +        if (xcnt > sizeof(num)/sizeof(WCHAR))
> +            xcnt = sizeof(num)/sizeof(WCHAR);
> +        lstrcpynW( num, begin + 1, xcnt );
> +        begin += xcnt + 1;

Truncating the string is not a correct fix. Overflow should either be
treated as an error, or a buffer should be allocated dynamically.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list