From: Howard Chu Date: Sat, 18 Oct 2003 21:59:53 +0000 (+0000) Subject: Make space for trailing NUL X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~545 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=66368d28f4f277dfc9aa1975b77194c74be8632c;p=openldap Make space for trailing NUL --- diff --git a/libraries/liblunicode/ucstr.c b/libraries/liblunicode/ucstr.c index d854b2aead..474837ae6b 100644 --- a/libraries/liblunicode/ucstr.c +++ b/libraries/liblunicode/ucstr.c @@ -252,8 +252,8 @@ struct berval * UTF8bvnormalize( last = i; /* Allocate more space in out if necessary */ - if (len - i > outsize - outpos) { - outsize = outsize + ((len - i) - (outsize - outpos)); + if (len - i >= outsize - outpos) { + outsize += 1 + ((len - i) - (outsize - outpos)); outtmp = (char *) realloc(out, outsize); if (outtmp == NULL) { free(out);