From bb1584c878678ba2949c4c65087404b12671a36c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 12 May 1998 21:33:44 +0000 Subject: [PATCH] (stat, get_long_basename): Fail if filename contains any characters that are illegal in file names. --- src/w32.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.39.2