From 5b729848bea9433b5473a31cbf3b53aa373fa0a2 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Nov 2015 22:29:53 +0100 Subject: [PATCH] Fix off by one when cutting utf8-strings --- libcitadel/lib/stringbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index cf786ab5f..12fd259e4 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -4142,11 +4142,11 @@ long StrBuf_Utf8StrCut(StrBuf *Buf, int maxlen) n++; aptr++; } - if (n > maxlen) { + if (n >= maxlen) { *aptr = '\0'; Buf->BufUsed = aptr - Buf->buf; return Buf->BufUsed; - } + } } return Buf->BufUsed; -- 2.30.2