php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #69523
Patch not_tested_check_for_name_argument revision 2015-04-24 11:11 UTC by florian dot schmidt dot welzow at t-online dot de

Patch not_tested_check_for_name_argument for *Web Server problem Bug #69523

Patch version 2015-04-24 11:11 UTC

Return to Bug #69523 | Download this patch
Patch Revisions:

Developer: florian.schmidt.welzow@t-online.de

From e02661ffeafc501ca05935471df5c0a44ae49464 Mon Sep 17 00:00:00 2001
From: Florian <florian.schmidt.welzow@t-online.de>
Date: Fri, 24 Apr 2015 13:08:50 +0200
Subject: [PATCH] Add check for name parameter

Not tested fix for bug 69523
---
 ext/standard/head.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ext/standard/head.c b/ext/standard/head.c
index bdb3e59..4769459 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -86,6 +86,11 @@ PHPAPI int php_setcookie(char *name, size_t name_len, char *value, size_t value_
 	int result;
 	zend_string *encoded_value = NULL;
 
+	if (!name || name_len == 0) {
+		zend_error( E_WARNING, "setcookie: First argument name is required." );
+		return FAILURE;
+	}
+
 	if (name && strpbrk(name, "=,; \t\r\n\013\014") != NULL) {   /* man isspace for \013 and \014 */
 		zend_error( E_WARNING, "Cookie names cannot contain any of the following '=,; \\t\\r\\n\\013\\014'" );
 		return FAILURE;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 21:01:36 2024 UTC