diff -r cdbd9c0c0775 -r e60c492a0d9b mercurial/osutil.c --- 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) {