diff options
| author | Eli Zaretskii | 2014-09-22 17:37:22 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-22 17:37:22 +0300 |
| commit | f11af8a48cfef05314e6e5d86e18861cffbde9f1 (patch) | |
| tree | c054f3ed5855b72d0330e8adf0f13cd208281a16 /src/fileio.c | |
| parent | 601a0cfe861eac8ed706a2bb3380c5788a1ef701 (diff) | |
| download | emacs-f11af8a48cfef05314e6e5d86e18861cffbde9f1.tar.gz emacs-f11af8a48cfef05314e6e5d86e18861cffbde9f1.zip | |
Fix bug #18516 with SIGSEGV in expand-file-name.
src/fileio.c (Fexpand_file_name) [DOS_NT]: Make sure newdirlim is
always set to a valid value. Make sure the size passed to alloca
is always positive.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index 80905c63d3a..13e2c889020 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1237,6 +1237,8 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1237 | newdirlim = adir + SBYTES (tem); | 1237 | newdirlim = adir + SBYTES (tem); |
| 1238 | memcpy (adir, SSDATA (tem), SBYTES (tem) + 1); | 1238 | memcpy (adir, SSDATA (tem), SBYTES (tem) + 1); |
| 1239 | } | 1239 | } |
| 1240 | else | ||
| 1241 | newdirlim = adir + strlen (adir); | ||
| 1240 | } | 1242 | } |
| 1241 | if (!adir) | 1243 | if (!adir) |
| 1242 | { | 1244 | { |
| @@ -1383,6 +1385,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1383 | 1385 | ||
| 1384 | /* Now concatenate the directory and name to new space in the stack frame. */ | 1386 | /* Now concatenate the directory and name to new space in the stack frame. */ |
| 1385 | tlen = length + file_name_as_directory_slop + (nmlim - nm) + 1; | 1387 | tlen = length + file_name_as_directory_slop + (nmlim - nm) + 1; |
| 1388 | eassert (tlen > file_name_as_directory_slop + 1); | ||
| 1386 | #ifdef DOS_NT | 1389 | #ifdef DOS_NT |
| 1387 | /* Reserve space for drive specifier and escape prefix, since either | 1390 | /* Reserve space for drive specifier and escape prefix, since either |
| 1388 | or both may need to be inserted. (The Microsoft x86 compiler | 1391 | or both may need to be inserted. (The Microsoft x86 compiler |