OSSP CVS Repository

ossp - Check-in [4267]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4267
Date: 2001-Aug-01 16:37:32 (local)
2001-Aug-01 14:37:32 (UTC)
User:simons
Branch:callback-semantic-rewrite
Comment: - Make sure that used_buffer_size is initialized to zero before the callback is executed.

- Use used_buffer_size to determine the new size of the reallocated buffer in case of an overflow. If used_buffer_size is 0 (default), use 1 instead.

Tickets:
Inspections:
Files:
ossp-pkg/xds/vdecode.c      1.4.2.3 -> 1.4.2.4     1 inserted, 1 deleted
ossp-pkg/xds/vencode.c      1.12.2.4 -> 1.12.2.5     3 inserted, 2 deleted

ossp-pkg/xds/vdecode.c 1.4.2.3 -> 1.4.2.4

--- vdecode.c    2001/08/01 13:26:29     1.4.2.3
+++ vdecode.c    2001/08/01 14:37:32     1.4.2.4
@@ -69,7 +69,7 @@
         if (strlen(name) > 0)
             {
             size_t pos;
-            size_t used_buffer_size;
+            size_t used_buffer_size = 0;
             if (xds_find_engine(xds->engines, xds->engines_len, name, &pos))
                 {
                 rc = (*xds->engines[pos].engine)(xds,


ossp-pkg/xds/vencode.c 1.12.2.4 -> 1.12.2.5

--- vencode.c    2001/08/01 13:26:29     1.12.2.4
+++ vencode.c    2001/08/01 14:37:32     1.12.2.5
@@ -42,7 +42,7 @@
 
     xds_check_parameter(xds != NULL);
     xds_check_parameter(fmt_arg != NULL);
-    xds_check_parameter(xds->mode == XDS_ENCODE);
+    assert(xds->mode == XDS_ENCODE);
     if (xds->mode != XDS_ENCODE)
         return XDS_ERR_INVALID_MODE;
 
@@ -117,6 +117,7 @@
 
                 /* Execute the engine. */
 
+                used_buffer_size = 0;
                 args_backup = args;
                 rc = (*xds->engines[pos].engine)(xds,
                                                  xds->engines[pos].context,
@@ -140,7 +141,7 @@
 
                     rc = xds_set_capacity((void**)&xds->buffer,
                                           &xds->buffer_capacity,
-                                          xds->buffer_capacity + 1,
+                                          xds->buffer_capacity + ((used_buffer_size == 0) ? 1 : used_buffer_size),
                                           sizeof(char),
                                           XDS_INITIAL_BUFFER_CAPACITY);
                     assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);

CVSTrac 2.0.1