4 Jul
2006
4 Jul
'06
8:44 a.m.
"Saulius Krasuckas" <saulius.krasuckas(a)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.