diff options
| author | Richard M. Stallman | 1998-05-12 21:33:44 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-12 21:33:44 +0000 |
| commit | bb1584c878678ba2949c4c65087404b12671a36c (patch) | |
| tree | a6b3b104fb9ec01c90d7183fc9fc7a38cad55131 /src | |
| parent | 7d3159862ce14bf1f202982f7d31f1c76ba00e25 (diff) | |
| download | emacs-bb1584c878678ba2949c4c65087404b12671a36c.tar.gz emacs-bb1584c878678ba2949c4c65087404b12671a36c.zip | |
(stat, get_long_basename): Fail if filename contains any
characters that are illegal in file names.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -464,6 +464,10 @@ get_long_basename (char * name, char * buf, int size) | |||
| 464 | HANDLE dir_handle; | 464 | HANDLE dir_handle; |
| 465 | int len = 0; | 465 | int len = 0; |
| 466 | 466 | ||
| 467 | /* must be valid filename, no wild cards or other illegal characters */ | ||
| 468 | if (strpbrk (name, "*?|<>\"")) | ||
| 469 | return 0; | ||
| 470 | |||
| 467 | dir_handle = FindFirstFile (name, &find_data); | 471 | dir_handle = FindFirstFile (name, &find_data); |
| 468 | if (dir_handle != INVALID_HANDLE_VALUE) | 472 | if (dir_handle != INVALID_HANDLE_VALUE) |
| 469 | { | 473 | { |
| @@ -1639,8 +1643,8 @@ stat (const char * path, struct stat * buf) | |||
| 1639 | } | 1643 | } |
| 1640 | 1644 | ||
| 1641 | name = (char *) map_w32_filename (path, &path); | 1645 | name = (char *) map_w32_filename (path, &path); |
| 1642 | /* must be valid filename, no wild cards */ | 1646 | /* must be valid filename, no wild cards or other illegal characters */ |
| 1643 | if (strchr (name, '*') || strchr (name, '?')) | 1647 | if (strpbrk (name, "*?|<>\"")) |
| 1644 | { | 1648 | { |
| 1645 | errno = ENOENT; | 1649 | errno = ENOENT; |
| 1646 | return -1; | 1650 | return -1; |