pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret.c,v 1.314 2003/08/04 15:05:09 mast Exp $ + || $Id: interpret.c,v 1.315 2003/08/04 15:17:28 mast Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.314 2003/08/04 15:05:09 mast Exp $"); + RCSID("$Id: interpret.c,v 1.315 2003/08/04 15:17:28 mast Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:2016:      PMOD_EXPORT void safe_apply(struct object *o, const char *fun ,INT32 args)   {    int id;   #ifdef PIKE_DEBUG    if(!o->prog) Pike_fatal("Apply safe on destructed object.\n");   #endif    id = find_identifier(fun, o->prog);    if (id >= 0)    safe_apply_low2(o, id, args, 1); -  else -  Pike_error ("Cannot call unknown function \"%s\".\n", fun); +  else { +  char buf[4096]; + #ifdef HAVE_VSNPRINTF +  vsnprintf(buf, 4090, "Cannot call unknown function \"%s\".\n", fun); + #else +  VSPRINTF(buf, "Cannot call unknown function \"%s\".\n", fun); + #endif +  if ((size_t) strlen (buf) >= (size_t) sizeof (buf)) +  Pike_fatal ("Buffer overflow in safe_apply()\n"); +  push_error (buf); +  free_svalue (&throw_value); +  move_svalue (throw_value, --Pike_sp); +  call_handle_error(); +  push_int (0);    } -  + }      /* Returns nonzero if the function was called in some handler. */   PMOD_EXPORT int low_unsafe_apply_handler(const char *fun,    struct object *handler,    struct object *compat,    INT32 args)   {    int i;   #if 0    fprintf(stderr, "low_unsafe_apply_handler(\"%s\", 0x%08p, 0x%08p, %d)\n",