Mercurial > hg > xemacs-beta
comparison src/dumper.c @ 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 | a4917b3c97cc |
children | 1a14c304cb8e |
comparison
equal
deleted
inserted
replaced
4136:db22824aa020 | 4137:1ce0622a56a3 |
---|---|
2657 { | 2657 { |
2658 Wexttext *wexe = MULTIBYTE_TO_WEXTTEXT ((Extbyte *) exe_path); | 2658 Wexttext *wexe = MULTIBYTE_TO_WEXTTEXT ((Extbyte *) exe_path); |
2659 wext_strcpy (exe_path, wexe); | 2659 wext_strcpy (exe_path, wexe); |
2660 } | 2660 } |
2661 #else /* !WIN32_NATIVE */ | 2661 #else /* !WIN32_NATIVE */ |
2662 Wexttext *exe_path; | 2662 Wexttext exe_path[PATH_MAX_EXTERNAL]; |
2663 Wexttext *w; | 2663 Wexttext *w; |
2664 const Wexttext *dir, *p; | 2664 const Wexttext *dir, *p; |
2665 | 2665 |
2666 #ifdef DUMP_IN_EXEC | 2666 #ifdef DUMP_IN_EXEC |
2667 if (pdump_ram_try ()) | 2667 if (pdump_ram_try ()) |
2691 p--; | 2691 p--; |
2692 | 2692 |
2693 if (p != dir) | 2693 if (p != dir) |
2694 { | 2694 { |
2695 /* invocation-name includes a directory component -- presumably it | 2695 /* invocation-name includes a directory component -- presumably it |
2696 is relative to cwd, not $PATH */ | 2696 is relative to cwd, not $PATH. */ |
2697 exe_path = alloca_array (Wexttext, 1 + wext_strlen (dir)); | |
2698 wext_strcpy (exe_path, dir); | 2697 wext_strcpy (exe_path, dir); |
2699 } | 2698 } |
2700 else | 2699 else |
2701 { | 2700 { |
2702 const Wexttext *path = wext_getenv ("PATH"); /* not egetenv -- | 2701 const Wexttext *path = wext_getenv ("PATH"); /* not egetenv -- |
2703 not yet init. */ | 2702 not yet init. */ |
2704 const Wexttext *name = p; | 2703 const Wexttext *name = p; |
2705 exe_path = alloca_array (Wexttext, | |
2706 10 + max (wext_strlen (name), | |
2707 wext_strlen (path))); | |
2708 for (;;) | 2704 for (;;) |
2709 { | 2705 { |
2710 p = path; | 2706 p = path; |
2711 while (*p && *p != SEPCHAR) | 2707 while (*p && *p != SEPCHAR) |
2712 p++; | 2708 p++; |