[Date Prev][Date Next] [Chronological] [Thread] [Top]

related to ITS 506 (ITS#507)



Full_Name: Mei-Hui Su
Version: dev tree
OS: solaris 2.7
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (128.9.64.206)


A patch for servers/slapd/back-tcl/tcl_modify.c

jupiter 38% diff -u tcl_modify.c new_tcl_modify.c
--- tcl_modify.c        Wed Apr 19 12:50:17 2000
+++ new_tcl_modify.c    Wed Apr 19 12:50:07 2000
@@ -62,8 +62,10 @@
 
                len = strlen (mods->mod_type) + strlen (op) + 7;
                while (bp + len - tcl_mods > bsize) {
+                       size_t offset = bp - tcl_mods;
                        bsize += BUFSIZ;
                        tcl_mods = (char *) ch_realloc (tcl_mods, bsize);
+                       bp = &tcl_mods[offset];
                }
                sprintf (bp, "{ {%s: %s} ", op, mods->mod_type);
                bp += len;
@@ -75,8 +77,10 @@
                                mods->mod_bvalues[i]->bv_val) + 5 +
                                (mods->mod_bvalues[i + 1] == NULL ? 2 : 0);
                        while (bp + len - tcl_mods > bsize) {
+                               size_t offset = bp - tcl_mods;
                                bsize += BUFSIZ;
                                tcl_mods = (char *) ch_realloc (tcl_mods,
bsize);
+                               bp = &tcl_mods[offset];
                        }
                        sprintf (bp, "{%s: %s} %s", mods->mod_type,
                                mods->mod_bvalues[i]->bv_val,



mei