Commit 6aff66cf authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Apply patch suggested in ITS#2737 to address underallocation bug.

This could should be reworked to avoid multiple reallocs (likely
by overallocating).
parent 2d910bf1
......@@ -251,6 +251,18 @@ struct berval * UTF8bvnormalize(
last = i;
/* Allocate more space in out if necessary */
if (len - i > outsize - outpos) {
outsize = outsize + ((len - i) - (outsize - outpos));
outtmp = (char *) realloc(out, outsize);
if (outtmp == NULL) {
free(out);
free(ucs);
return NULL;
}
out = outtmp;
}
/* s[i] is ascii */
/* finish off everything up to char before next non-ascii */
for ( i++; (i < len) && LDAP_UTF8_ISASCII(s + i); i++ ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment