OSSP CVS Repository

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

ossp-pkg/xds/xdr-encode-octetstream.c 1.4.2.2 -> 1.4.2.3

--- xdr-encode-octetstream.c     2001/08/01 13:26:29     1.4.2.2
+++ xdr-encode-octetstream.c     2001/08/01 14:38:07     1.4.2.3
@@ -36,19 +36,13 @@
     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);
+    xds_init_encoding_engine(4);
 
     /* Get value from stack and calculate the correct amount of
        padding. */
 
     p       = (xds_uint8_t*)va_arg(*args, void*);
-    assert(p != NULL);
+    xds_check_parameter(p != NULL);
     p_len   = va_arg(*args, size_t);
     padding = (4 - (p_len & 0x03)) & 0x03;
     assert((p_len + padding) % 4 == 0);
@@ -56,10 +50,9 @@
     /* We need (4 + p_len + padding) bytes in the buffer to format our
        parameter. If we don't have them, return an underflow error. */
 
-    if (buffer_size < 4 + p_len + padding)
-        return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + p_len + padding;
+    *used_buffer_size = 4 + p_len + padding;
+    if (buffer_size < *used_buffer_size)
+        return XDS_ERR_OVERFLOW;
 
     /* Format the values into the buffer. */
 

CVSTrac 2.0.1