Skip to content

Commit

Permalink
addslashes() on messages from users before inserting into db.
Browse files Browse the repository at this point in the history
  • Loading branch information
defacer committed Sep 9, 2004
1 parent 06dc71e commit a10b3ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mod/chat/chatd.php
Expand Up @@ -408,9 +408,16 @@ function dispatch_sidekick($handle, $type, $sessionid, $customdata) {
break;
}

// A slight hack to prevent malformed SQL inserts
$origmsg = $msg->message;
$msg->message = addslashes($msg->message);

// Commit to DB
insert_record('chat_messages', $msg);

// Undo the hack
$msg->message = $origmsg;

// OK, now push it out to all users
$this->message_broadcast($msg, $this->sets_info[$sessionid]['user']);

Expand Down

0 comments on commit a10b3ad

Please sign in to comment.