[PATCH 1/2] kernel/tests: Implement safe local strcat function.
Saulius Krasuckas
saulius2 at ar.fi.lt
Tue Jul 4 05:37:13 CDT 2006
* On Tue, 4 Jul 2006, Dmitry Timoshkov wrote:
> * "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.
By "safe" I meant it doesn't overflow buffer. Does it do?
But well, would your reactions was the the same if I'd called this
local_strcatA(), uhm?
More information about the wine-devel
mailing list