php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #59972
Patch stomp.patch revision 2011-10-12 12:50 UTC by jthijssen at noxlogic dot nl

Patch stomp.patch for stomp Bug #59972

Patch version 2011-10-12 12:50 UTC

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

Developer: jthijssen@noxlogic.nl

Index: stomp.c
===================================================================
--- stomp.c	(revision 317407)
+++ stomp.c	(working copy)
@@ -473,7 +473,7 @@
 	while (1) {
 		char *p = NULL;
 		length = stomp_read_line(stomp, &p);
-		
+
 		if (length < 0) {
 			RETURN_READ_FRAME_FAIL;
 		}
@@ -506,7 +506,7 @@
 	}
 
 	/* Check for the content length */
-	if (zend_hash_find(f->headers, "content-length", strlen("content-length"), (void **)&length_str) == SUCCESS) {
+	if (zend_hash_find(f->headers, "content-length", strlen("content-length") + 1, (void **)&length_str) == SUCCESS) {
 		char endbuffer[2];
 		length = 2;
 
@@ -534,13 +534,13 @@
 	int success = 1;
 	char error[1024];
 	char *receipt = NULL;
-	if (zend_hash_find(frame->headers, "receipt", sizeof("receipt"), (void **)&receipt) == SUCCESS) {
+	if (zend_hash_find(frame->headers, "receipt", sizeof("receipt") + 1, (void **)&receipt) == SUCCESS) {
 		stomp_frame_t *res = stomp_read_frame(stomp);
 		success = 0;
 		if (res) {
 			if (0 == strncmp("RECEIPT", res->command, sizeof("RECEIPT") - 1)) {
 				char *receipt_id = NULL;
-				if (zend_hash_find(res->headers, "receipt-id", sizeof("receipt-id"), (void **)&receipt_id) == SUCCESS
+				if (zend_hash_find(res->headers, "receipt-id", sizeof("receipt-id") + 1, (void **)&receipt_id) == SUCCESS
 						&& strlen(receipt) == strlen(receipt_id)
 						&& !strcmp(receipt, receipt_id)) {
 					success = 1;
@@ -550,7 +550,7 @@
 				}
 			} else if (0 == strncmp("ERROR", res->command, sizeof("ERROR") - 1)) {
 				char *error_msg = NULL;
-				if (zend_hash_find(res->headers, "message", sizeof("message"), (void **)&error_msg) == SUCCESS) {
+				if (zend_hash_find(res->headers, "message", sizeof("message") + 1, (void **)&error_msg) == SUCCESS) {
 					stomp_set_error(stomp, error_msg, 0, res->body);
 				}
 			} else {
Index: php_stomp.c
===================================================================
--- php_stomp.c	(revision 317407)
+++ php_stomp.c	(working copy)
@@ -990,7 +990,7 @@
 			array_init(return_value);
 			add_assoc_string_ex(return_value, "command", sizeof("command"), res->command, 1);
 			if (res->body) {
-				add_assoc_string_ex(return_value, "body", sizeof("body"), res->body, 1);
+				add_assoc_stringl_ex(return_value, "body", sizeof("body"), res->body, res->body_length, 1);
 			}
 			add_assoc_zval_ex(return_value, "headers", sizeof("headers"), headers);
 		}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 16:01:31 2024 UTC