From: Richard M. Stallman Date: Tue, 12 May 1998 21:33:44 +0000 (+0000) Subject: (stat, get_long_basename): Fail if filename contains any X-Git-Tag: emacs-20.3~1038 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bb1584c878678ba2949c4c65087404b12671a36c;p=emacs.git (stat, get_long_basename): Fail if filename contains any characters that are illegal in file names. --- diff --git a/src/w32.c b/src/w32.c index 42027ae2052..eaf0a6c3d18 100644 --- a/src/w32.c +++ b/src/w32.c @@ -464,6 +464,10 @@ get_long_basename (char * name, char * buf, int size) HANDLE dir_handle; int len = 0; + /* must be valid filename, no wild cards or other illegal characters */ + if (strpbrk (name, "*?|<>\"")) + return 0; + dir_handle = FindFirstFile (name, &find_data); if (dir_handle != INVALID_HANDLE_VALUE) { @@ -1639,8 +1643,8 @@ stat (const char * path, struct stat * buf) } name = (char *) map_w32_filename (path, &path); - /* must be valid filename, no wild cards */ - if (strchr (name, '*') || strchr (name, '?')) + /* must be valid filename, no wild cards or other illegal characters */ + if (strpbrk (name, "*?|<>\"")) { errno = ENOENT; return -1;