diff options
author | Gerald Carter <jerry@samba.org> | 2003-08-25 20:42:24 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-08-25 20:42:24 +0000 |
commit | 6153bc0f5bbf67d17bcfd21c2e8581defbe3a84f (patch) | |
tree | ed61aa04c028db8eee7284b2d60103229ff29055 /source3/lib | |
parent | a1d6ba950bca1b893034fee57d03d76aacbcfb66 (diff) | |
download | samba-6153bc0f5bbf67d17bcfd21c2e8581defbe3a84f.tar.gz samba-6153bc0f5bbf67d17bcfd21c2e8581defbe3a84f.tar.bz2 samba-6153bc0f5bbf67d17bcfd21c2e8581defbe3a84f.zip |
fix bug 289; make sure to reset the offset into a string when reallocating space
(This used to be commit 66dd20c7eaa66abdf99fa57475ccc4c9f978f1b5)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_str.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index eb1c70d412..c356fdcab7 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -910,6 +910,7 @@ char *realloc_string_sub(char *string, const char *pattern, const char *insert) while ((p = strstr(s,pattern))) { if (ld > 0) { + int offset = PTR_DIFF(s,string); char *t = Realloc(string, ls + ld + 1); if (!t) { DEBUG(0, ("realloc_string_sub: out of memory!\n")); @@ -917,7 +918,7 @@ char *realloc_string_sub(char *string, const char *pattern, const char *insert) return NULL; } string = t; - p = t + (p - s); + p = t + offset + (p - s); } if (li != lp) { memmove(p+li,p+lp,strlen(p+lp)+1); |