Mercurial > hg > xemacs-beta
changeset 4137:1ce0622a56a3
[xemacs-hg @ 2007-08-22 15:10:10 by aidan]
Patch from Nix; fix buffer overrun in pdump_load()
See
87y7r4lzwf.fsf@hades.wkstn.nix , also
http://calypso.tux.org/pipermail/xemacs-patches/2006-October/000017.html
for explanation
author | aidan |
---|---|
date | Wed, 22 Aug 2007 15:10:19 +0000 |
parents | db22824aa020 |
children | 4dd678fb2fb6 |
files | src/ChangeLog src/dumper.c src/text.h |
diffstat | 3 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Aug 22 07:15:29 2007 +0000 +++ b/src/ChangeLog Wed Aug 22 15:10:19 2007 +0000 @@ -1,3 +1,9 @@ +2006-10-26 Nix <nix@esperi.org.uk> + + * dumper.c (pdump_load): Statically allocate a large enough + exe_path for all conceivable uses. Fixes a buffer overrun. + * text.h (MAX_XETCHAR_SIZE): Define, for PATH_MAX_EXTERNAL. + 2007-08-21 Aidan Kehoe <kehoea@parhasard.net> * mule-ccl.c (ccl_driver):
--- a/src/dumper.c Wed Aug 22 07:15:29 2007 +0000 +++ b/src/dumper.c Wed Aug 22 15:10:19 2007 +0000 @@ -2659,7 +2659,7 @@ wext_strcpy (exe_path, wexe); } #else /* !WIN32_NATIVE */ - Wexttext *exe_path; + Wexttext exe_path[PATH_MAX_EXTERNAL]; Wexttext *w; const Wexttext *dir, *p; @@ -2693,8 +2693,7 @@ if (p != dir) { /* invocation-name includes a directory component -- presumably it - is relative to cwd, not $PATH */ - exe_path = alloca_array (Wexttext, 1 + wext_strlen (dir)); + is relative to cwd, not $PATH. */ wext_strcpy (exe_path, dir); } else @@ -2702,9 +2701,6 @@ const Wexttext *path = wext_getenv ("PATH"); /* not egetenv -- not yet init. */ const Wexttext *name = p; - exe_path = alloca_array (Wexttext, - 10 + max (wext_strlen (name), - wext_strlen (path))); for (;;) { p = path;
--- a/src/text.h Wed Aug 22 07:15:29 2007 +0000 +++ b/src/text.h Wed Aug 22 15:10:19 2007 +0000 @@ -2988,6 +2988,7 @@ /* Extra indirection needed in case of manifest constant as arg */ #define WEXTSTRING_1(arg) L##arg #define WEXTSTRING(arg) WEXTSTRING_1(arg) +#define MAX_XETCHAR_SIZE sizeof (WCHAR) #define wext_strlen wcslen #define wext_strcmp wcscmp #define wext_strncmp wcsncmp @@ -3013,6 +3014,7 @@ #else #define WEXTTEXT_ZTERM_SIZE sizeof (char) #define WEXTSTRING(arg) arg +#define MAX_XETCHAR_SIZE sizeof (char) #define wext_strlen strlen #define wext_strcmp strcmp #define wext_strncmp strncmp