Skip to content

Commit

Permalink
SECURITY Using JSON instead of serialize() to stringify user data in …
Browse files Browse the repository at this point in the history
…PageCommentsInterface
  • Loading branch information
chillu committed Sep 15, 2011
1 parent b5ea2f6 commit d15e850
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/sitefeatures/PageCommentInterface.php
Expand Up @@ -222,7 +222,7 @@ function PostCommentForm() {
foreach($fields as $field) {
if(!$field instanceof HiddenField) $visibleFields[] = $field->Name();
}
$form->loadDataFrom(unserialize($cookie), false, $visibleFields);
$form->loadDataFrom(Convert::json2array($cookie), false, $visibleFields);
}

return $form;
Expand Down Expand Up @@ -272,7 +272,7 @@ function DeleteAllLink() {
*/
class PageCommentInterface_Form extends Form {
function postcomment($data) {
Cookie::set("PageCommentInterface_Data", serialize($data));
Cookie::set("PageCommentInterface_Data", Convert::raw2json($data));

// Spam filtering
if(SSAkismet::isEnabled()) {
Expand Down Expand Up @@ -333,7 +333,7 @@ function postcomment($data) {
$comment->write();

unset($data['Comment']);
Cookie::set("PageCommentInterface_Data", serialize($data));
Cookie::set("PageCommentInterface_Data", Convert::raw2json($data));

$moderationMsg = _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");

Expand Down

0 comments on commit d15e850

Please sign in to comment.