Don't let very long directory names overrun the stack.
commitf38a7f07ee1a4862efff9e5985c2b251e4dcde58
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Aug 2013 17:57:07 +0000 (23 10:57 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Aug 2013 17:57:07 +0000 (23 10:57 -0700)
treedc434ded852d1772a9f612c5c0ae3dbd9370838f
parent91c5cc05b79c7d609a1a61f19058f6d2cbf4d943
Don't let very long directory names overrun the stack.

Fix some related minor problems involving "//", vfork.
* callproc.c (encode_current_directory): New function.
(call_process): Don't append "/"; not needed.
* fileio.c (file_name_as_directory_slop): New constant.
(file_name_as_directory): Allow SRC to be longer than SRCLEN;
this can save the caller having to alloca.
(Ffile_name_as_directory, Fdirectory_file_name, Fexpand_file_name):
Use SAFE_ALLOCA, not alloca.
(directory_file_name, Fexpand_file_name): Leave leading "//"
alone, since it can be special even on POSIX platforms.
* callproc.c (call_process):
* process.c (Fformat_network_address):
* sysdep.c (sys_subshell):
Use encode_current_directory rather than rolling our own.
(create_process): No need to encode directory; caller does that now.
* process.h (encode_current_directory): New decl.
* sysdep.c (sys_subshell): Work even if vfork trashes saved_handlers.
Rework to avoid 'goto xyzzy;'.
src/ChangeLog
src/callproc.c
src/fileio.c
src/process.c
src/process.h
src/sysdep.c