Skip to content
This repository
Browse code

SECURITY Using JSON instead of serialize() to stringify user data in …

…PageCommentsInterface
  • Loading branch information...
commit d15e8509b01ff2dbbe3028a055021a29b1065b22 1 parent b5ea2f6
Ingo Schommer authored September 08, 2011
6  code/sitefeatures/PageCommentInterface.php
@@ -222,7 +222,7 @@ function PostCommentForm() {
222 222
 			foreach($fields as $field) {
223 223
 				if(!$field instanceof HiddenField) $visibleFields[] = $field->Name();
224 224
 			}
225  
-			$form->loadDataFrom(unserialize($cookie), false, $visibleFields);
  225
+			$form->loadDataFrom(Convert::json2array($cookie), false, $visibleFields);
226 226
 		}
227 227
 
228 228
 		return $form;
@@ -272,7 +272,7 @@ function DeleteAllLink() {
272 272
  */
273 273
 class PageCommentInterface_Form extends Form {
274 274
 	function postcomment($data) {
275  
-		Cookie::set("PageCommentInterface_Data", serialize($data));
  275
+		Cookie::set("PageCommentInterface_Data", Convert::raw2json($data));
276 276
 
277 277
 		// Spam filtering
278 278
 		if(SSAkismet::isEnabled()) {
@@ -333,7 +333,7 @@ function postcomment($data) {
333 333
 		$comment->write();
334 334
 		
335 335
 		unset($data['Comment']);
336  
-		Cookie::set("PageCommentInterface_Data", serialize($data));
  336
+		Cookie::set("PageCommentInterface_Data", Convert::raw2json($data));
337 337
 		
338 338
 		$moderationMsg = _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");
339 339
 		

0 notes on commit d15e850

Please sign in to comment.
Something went wrong with that request. Please try again.