osutil: stop using strcpy
strcpy is a security vulnerability masquerading as a utility
function. Replace it with memcpy since we know how much to copy
anyway.
--- a/mercurial/osutil.c Sat Mar 19 11:39:13 2016 -0700
+++ b/mercurial/osutil.c Sat Mar 19 20:02:19 2016 -0400
@@ -203,14 +203,15 @@
PyErr_NoMemory();
goto error_nomem;
}
- strcpy(pattern, path);
+ memcpy(pattern, path, plen);
if (plen > 0) {
char c = path[plen-1];
if (c != ':' && c != '/' && c != '\\')
pattern[plen++] = '\\';
}
- strcpy(pattern + plen, "*");
+ pattern[plen++] = '*';
+ pattern[plen] = '\0';
fh = FindFirstFileA(pattern, &fd);
if (fh == INVALID_HANDLE_VALUE) {