OSSP CVS Repository

ossp - Ticket #61
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 61: xdr_decode_string does not zero-terminate the resulting string

The zero-terminating is done on the wrong buffer... I'll attach a patch!
[Append remarks]

Remarks:

2005-May-31 15:08:15 by anonymous:
I didn't find any "attach" function so I provide the patch here:

--- xds-0.9.1/xds_engine_xdr.c  2004-09-12 19:24:34.000000000 +0200
+++ xds-0.9.1-patched/xds_engine_xdr.c  2005-05-31 14:30:06.388110990 +0200
@@ -696,7 +696,7 @@

     /* Copy data into the buffer. */
     memmove(*p, (xds_uint8_t *)buffer + 4, p_len);
-    ((xds_uint8_t *)buffer)[4 + p_len] = '\0';
+    ((xds_uint8_t *)*p)[p_len] = '\0';

     return XDS_OK;
 }

2005-May-31 15:17:47 by anonymous:
Simpler patch:

--- xds-0.9.1/xds_engine_xdr.c  2004-09-12 19:24:34.000000000 +0200
+++ xds-0.9.1-patched/xds_engine_xdr.c  2005-05-31 15:15:07.550781769 +0200
@@ -696,7 +696,7 @@

     /* Copy data into the buffer. */
     memmove(*p, (xds_uint8_t *)buffer + 4, p_len);
-    ((xds_uint8_t *)buffer)[4 + p_len] = '\0';
+    (*p)[p_len] = '\0';

     return XDS_OK;
 }
[Append remarks]

Properties:

Type: code           Version: 0.9.1 
Status: fixed          Created: 2005-May-31 15:06
Severity:          Last Change: 2005-Jun-02 20:43
Priority:          Subsystem: xds 
Assigned To:            Derived From:  
Creator: anonymous 

Related Check-ins:

2005-Jun-02 20:43 Check-in [5082]: Fix XDR string decoding function by NUL terminating the target buffer (instead of the source buffer). Submitted by: Unknown <ossp@jm.2good.nu> (By rse)

CVSTrac 2.0.1