aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert2011-08-04 19:15:35 -0700
committerPaul Eggert2011-08-04 19:15:35 -0700
commit0065d05491ce5981ea20896bb26d21dcd31e6769 (patch)
tree13240167319d4a99ab5eacae4a883258eb2d28de /src/callproc.c
parent18ab493650d648ab8dca651ea2698861f926e895 (diff)
downloademacs-0065d05491ce5981ea20896bb26d21dcd31e6769.tar.gz
emacs-0065d05491ce5981ea20896bb26d21dcd31e6769.zip
Adjust in response to jan.h.d's comments.
See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 993d943e158..4f6d363d5e2 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -252,7 +252,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
252 val = Qraw_text; 252 val = Qraw_text;
253 else 253 else
254 { 254 {
255 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); 255 SAFE_NALLOCA (args2, 1, nargs + 1);
256 args2[0] = Qcall_process; 256 args2[0] = Qcall_process;
257 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 257 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
258 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 258 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
@@ -720,7 +720,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
720 { 720 {
721 ptrdiff_t i; 721 ptrdiff_t i;
722 722
723 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); 723 SAFE_NALLOCA (args2, 1, nargs + 1);
724 args2[0] = Qcall_process; 724 args2[0] = Qcall_process;
725 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 725 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
726 coding_systems 726 coding_systems
@@ -1018,7 +1018,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
1018 else 1018 else
1019 { 1019 {
1020 USE_SAFE_ALLOCA; 1020 USE_SAFE_ALLOCA;
1021 SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); 1021 SAFE_NALLOCA (args2, 1, nargs + 1);
1022 args2[0] = Qcall_process_region; 1022 args2[0] = Qcall_process_region;
1023 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 1023 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1024 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 1024 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
@@ -1147,11 +1147,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1147 cleaned up in the usual way. */ 1147 cleaned up in the usual way. */
1148 { 1148 {
1149 register char *temp; 1149 register char *temp;
1150 register ptrdiff_t i; 1150 size_t i; /* size_t, because ptrdiff_t might overflow here! */
1151 1151
1152 i = SBYTES (current_dir); 1152 i = SBYTES (current_dir);
1153 if (min (PTRDIFF_MAX, SIZE_MAX) - 6 < i)
1154 memory_full (SIZE_MAX);
1155#ifdef MSDOS 1153#ifdef MSDOS
1156 /* MSDOS must have all environment variables malloc'ed, because 1154 /* MSDOS must have all environment variables malloc'ed, because
1157 low-level libc functions that launch subsidiary processes rely 1155 low-level libc functions that launch subsidiary processes rely