ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.86 by root, Mon Jan 12 03:40:21 2009 UTC vs.
Revision 1.87 by sf-marcmagus, Sun Oct 11 01:35:53 2009 UTC

32#include <time.h> 32#include <time.h>
33#include <signal.h> 33#include <signal.h>
34 34
35#include <global.h> 35#include <global.h>
36#include <material.h> 36#include <material.h>
37#include <object.h>
37 38
38#include <sys/time.h> 39#include <sys/time.h>
39#include <sys/resource.h> 40#include <sys/resource.h>
40 41
41#include <glib.h> 42#include <glib.h>
445 } 446 }
446 else 447 else
447 strcpy (input, tmp); 448 strcpy (input, tmp);
448 449
449 return; 450 return;
451}
452
453/******************************************************************************/
454
455/* Checks a player-provided string which will become the msg property of
456 * an object for dangerous input.
457 */
458bool
459msg_is_safe (const char *msg)
460{
461 bool safe = true;
462
463 /* Trying to cheat by getting data into the object */
464 if (!strncmp (msg, "endmsg", strlen ("endmsg")) || strstr (msg, "\nendmsg"))
465 safe = false;
466
467 /* Trying to make the object talk, and potentially access arbitrary code */
468 if (object::msg_has_dialogue (msg))
469 safe = false;
470
471 return safe;
450} 472}
451 473
452///////////////////////////////////////////////////////////////////////////// 474/////////////////////////////////////////////////////////////////////////////
453 475
454void 476void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines