[PATCH 1/2] kernel/tests: Implement safe local strcat function.
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Jul 4 03:44:37 CDT 2006
"Saulius Krasuckas" <saulius.krasuckas at ieee.org> wrote:
> +static void safe_strcatA(char *dst, DWORD dst_len, const char *src)
> +{
> + UINT length;
> + char *buff;
> +
> + length = lstrlenA(dst);
> + length += lstrlenA(src);
> + buff = HeapAlloc(GetProcessHeap(), 0, length + 1);
> +
> + lstrcpyA(buff, dst);
> + lstrcatA(buff, src);
> + lstrcpynA(dst, buff, dst_len);
> +
> + HeapFree(GetProcessHeap(), 0, buff);
> +}
This kind of "safe" wrappers doesn't makes the code be safer in reality,
needlessly clobbering the code instead.
--
Dmitry.
More information about the wine-devel
mailing list