Patch Make-enveloppe-body-binary-safe for amqp Bug #62352
Patch version 2012-06-18 15:50 UTC
Return to Bug #62352 |
Download this patch
Patch Revisions:
Developer: jpauli@php.net
Index: trunk/amqp_envelope.c
===================================================================
--- trunk/amqp_envelope.c (révision 326218)
+++ trunk/amqp_envelope.c (copie de travail)
@@ -57,7 +57,7 @@
/* Start adding values */
MAKE_STD_ZVAL(value);
- ZVAL_STRINGL(value, envelope->body, strlen(envelope->body), 1);
+ ZVAL_STRINGL(value, envelope->body, envelope->body_len, 1);
zend_hash_add(envelope->debug_info, "body", strlen("body") + 1, &value, sizeof(zval *), NULL);
MAKE_STD_ZVAL(value);
@@ -213,7 +213,7 @@
RETURN_FALSE;
}
- RETURN_STRING(envelope->body, 1);
+ RETURN_STRINGL(envelope->body, envelope->body_len, 1);
}
/* }}} */
Index: trunk/amqp_queue.c
===================================================================
--- trunk/amqp_queue.c (révision 326218)
+++ trunk/amqp_queue.c (copie de travail)
@@ -374,7 +374,8 @@
/* Put the final touches into the zval */
envelope->body = estrndup(message_body_buffer, body_target);
-
+ envelope->body_len = body_target;
+
/* Clean up message buffer */
if (message_body_buffer) {
efree(message_body_buffer);
Index: trunk/php_amqp.h
===================================================================
--- trunk/php_amqp.h (révision 326218)
+++ trunk/php_amqp.h (copie de travail)
@@ -322,6 +322,7 @@
typedef struct _amqp_envelope_object {
zend_object zo;
char *body;
+ size_t body_len;
char routing_key[255];
uint delivery_tag;
int delivery_mode;
|