Marcus Meissner meissner@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.