[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c xdebug/xdebug_var.c xdebug/xdebug_xml.c xdebug/xdebug_xml.h - Fixed bug #228: Binary safety for stream output and property fetches.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 12 Dec 2006 22:23:32 +0100

Date: Tue Dec 12 22:23:32 CET 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.75]
- Fixed bug #228: Binary safety for stream output and property fetches.

Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.111)
           xdebug/xdebug_var.c (version: 1.78)
           xdebug/xdebug_xml.c (version: 1.11)
           xdebug/xdebug_xml.h (version: 1.5)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- xdebug/xdebug_handler_dbgp.c:1.110 Mon Dec 11 20:38:24 2006 GMT
+++ xdebug/xdebug_handler_dbgp.c Tue Dec 12 20:23:32 2006 GMT
@@ -1229,7 +1229,7 @@
 
         message = xdebug_xml_node_init("stream");
         xdebug_xml_add_attribute_ex(message, "type", (char *)name, 0, 0);
- xdebug_xml_add_text_encode(message, xdstrdup(str));
+ xdebug_xml_add_text_encodel(message, xdstrndup(str, str_length), str_length);
         send_message(&XG(context), message TSRMLS_CC);
         xdebug_xml_node_dtor(message);
 
@@ -2122,7 +2122,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.110 $";
+ return "$Revision: 1.111 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- xdebug/xdebug_var.c:1.77 Sat Nov 11 20:57:23 2006 GMT
+++ xdebug/xdebug_var.c Tue Dec 12 20:23:32 2006 GMT
@@ -663,9 +663,9 @@
                 case IS_STRING:
                         xdebug_xml_add_attribute(node, "type", "string");
                         if (options->max_data == 0 || Z_STRLEN_PP(struc) <= options->max_data) {
- xdebug_xml_add_text_encode(node, xdstrdup(Z_STRVAL_PP(struc)));
+ xdebug_xml_add_text_encodel(node, xdstrndup(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)), Z_STRLEN_PP(struc));
                         } else {
- xdebug_xml_add_text_encode(node, xdstrndup(Z_STRVAL_PP(struc), options->max_data));
+ xdebug_xml_add_text_encodel(node, xdstrndup(Z_STRVAL_PP(struc), options->max_data), options->max_data);
                         }
                         xdebug_xml_add_attribute(node, "size", xdebug_sprintf("%d", Z_STRLEN_PP(struc)));
                         break;

[FILE: /xdebug/xdebug_xml.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- xdebug/xdebug_xml.c:1.10 Sat Oct 07 21:10:33 2006 GMT
+++ xdebug/xdebug_xml.c Tue Dec 12 20:23:32 2006 GMT
@@ -52,7 +52,7 @@
                 int new_len = 0;
                 char *encoded_text;
                 
- encoded_text = (char*) xdebug_base64_encode((unsigned char*) node->text, strlen(node->text), &new_len);
+ encoded_text = (char*) xdebug_base64_encode((unsigned char*) node->text, node->text_len, &new_len);
                 xdebug_str_add(output, encoded_text, 0);
                 efree(encoded_text);
         } else {
@@ -144,7 +144,7 @@
         xdfree(node);
 }
 
-void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int free_text, int encode)
+void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode)
 {
         xdebug_xml_text_node *node = xdmalloc(sizeof (xdebug_xml_text_node));
         node->free_value = free_text;
@@ -154,6 +154,7 @@
                 xdebug_xml_text_node_dtor(xml->text);
         }
         node->text = text;
+ node->text_len = length;
         xml->text = node;
         if (!encode && strstr(node->text, "]]>")) {
                 node->encode = 1;

[FILE: /xdebug/xdebug_xml.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xdebug/xdebug_xml.h:1.4 Sun Jan 01 14:27:27 2006 GMT
+++ xdebug/xdebug_xml.h Tue Dec 12 20:23:32 2006 GMT
@@ -40,6 +40,7 @@
         char *text;
         int free_value;
         int encode;
+ int text_len;
 };
 
 struct _xdebug_xml_node
@@ -60,9 +61,11 @@
 void xdebug_xml_add_attribute_ex(xdebug_xml_node* xml, char *attribute, char *value, int free_name, int free_value);
 void xdebug_xml_add_child(xdebug_xml_node *xml, xdebug_xml_node *child);
 
-void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int free_text, int encode);
-#define xdebug_xml_add_text(x,t) xdebug_xml_add_text_ex((x), (t), 1, 0)
-#define xdebug_xml_add_text_encode(x,t) xdebug_xml_add_text_ex((x), (t), 1, 1)
+void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode);
+#define xdebug_xml_add_text(x,t) xdebug_xml_add_text_ex((x), (t), strlen(t), 1, 0)
+#define xdebug_xml_add_text_encode(x,t) xdebug_xml_add_text_ex((x), (t), strlen(t), 1, 1)
+#define xdebug_xml_add_textl(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 0)
+#define xdebug_xml_add_text_encodel(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 1)
 
 void xdebug_xml_return_node(xdebug_xml_node* node, struct xdebug_str *output);
 void xdebug_xml_node_dtor(xdebug_xml_node* xml);
Received on Tue Dec 12 2006 - 22:23:36 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST