OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/xdr-decode-octetstream.c versions 1.3.2.2 and 1.3.2.3
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/xdr-decode-octetstream.c 1.3.2.2 -> 1.3.2.3

--- xdr-decode-octetstream.c     2001/08/01 13:26:29     1.3.2.2
+++ xdr-decode-octetstream.c     2001/08/01 14:38:07     1.3.2.3
@@ -36,32 +36,19 @@
     size_t* p_len;
     size_t  padding;
 
-    /* Consistency checks. */
-
-    xds_check_parameter(xds != NULL);
-    xds_check_parameter(buffer != NULL);
-    xds_check_parameter(buffer_size != 0);
-    xds_check_parameter(used_buffer_size != NULL);
-    xds_check_parameter(args != NULL);
-
-    /* Get pointers from the stack. */
+    xds_init_decoding_engine(4);
 
     p     = va_arg(*args, void**);
     p_len = va_arg(*args, size_t*);
-    assert(p != NULL);
-    assert(p_len != NULL);
+    xds_check_parameter(p != NULL);
+    xds_check_parameter(p_len != NULL);
 
     /* Read the size of the message. */
 
-    if (buffer_size >= 4)
-        {
-        *p_len  = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8;
-        *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8;
-        *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8;
-        *p_len += ((xds_uint8_t*)buffer)[3];
-        }
-    else
-        return XDS_ERR_UNDERFLOW;
+    *p_len  = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8;
+    *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8;
+    *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8;
+    *p_len += ((xds_uint8_t*)buffer)[3];
 
     /* Calculate padding. */
 
@@ -69,10 +56,9 @@
 
     /* Do we have enough data?. */
 
-    if (buffer_size < 4 + *p_len + padding)
+    *used_buffer_size = 4 + *p_len + padding;
+    if (buffer_size < *used_buffer_size)
         return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + *p_len + padding;
 
     /* Allocate buffer for the data. */
 

CVSTrac 2.0.1