Coverity: Stray pointer arithmetic: CID 400000
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 29 Feb 2012 19:57:22 +0000 (14:57 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 29 Feb 2012 19:57:22 +0000 (14:57 -0500)
* src/callint.c (Fcall_interactively): add new fcall array, which
is the one allocated, and make args value derive from that. Fill
in function in fcall, and arguments in args.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/callint.c

index 2fc4558..66b584d 100644 (file)
@@ -527,7 +527,8 @@ when reading the arguments.
                                   + argcount   /* visargs */
                                   + argcount   /* varies */
                    );
-               Lisp_Object *args = alloca_array(Lisp_Object, alloca_size) + 1;
+               Lisp_Object *fcall= alloca_array(Lisp_Object, alloca_size);
+               Lisp_Object *args = fcall+1;
                /* visargs is an array of either Qnil or user-friendlier
                    versions (often
                 *  strings) of previous arguments, to use in prompts for
@@ -545,7 +546,7 @@ when reading the arguments.
                REGISTER int argnum;
                struct gcpro gcpro1, gcpro2;
 
-               args[-1] = function;
+               fcall[0] = function;
                for (argnum = 0; argnum < alloca_size - 1; argnum++)
                        args[argnum] = Qnil;