mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-12 15:10:31 +08:00
Apply patch suggested in ITS#2737 to address underallocation bug.
This could should be reworked to avoid multiple reallocs (likely by overallocating).
This commit is contained in:
parent
2d910bf1f8
commit
6aff66cf67
@ -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++ ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user