pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
2014-09-09
2014-09-09 19:11:03 by Stephen R. van den Berg <srb@cuci.nl>
2b482f2e873326d1bce85ec5b7f275d9a75f49f9 (
7
lines) (+
5
/-
2
)
[
Show
|
Annotate
]
Branch:
8.0
Correct calculation for string sizes.
2332:
if(mag > s->s->size_shift) { struct pike_string *n;
-
ptrdiff_t l = s->s->len + chars
+
s->malloced;
+
ptrdiff_t l = s->s->len + chars
;
+
if (l <
s->malloced
)
+
l = s->malloced
;
n=begin_wide_shared_string(l,mag); pike_string_cpy(MKPCHARP_STR(n),s->s); n->len=s->s->len; s->s->len = s->malloced; /* Restore the real length */
-
free_string(s->s);
+
s->malloced=l;
-
+
free_string(s->s);
s->s=n; } else if(s->s->len+chars > s->malloced)