From dfa0b74516349f892b77f384d0c59ae2008199c2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Oct 2009 11:03:27 +1100 Subject: util: fixed place where we could look one byte past end of string We need to check the length before the value --- lib/util/charset/util_unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index 024dc70acc..045aa4a3e3 100644 --- a/lib/util/charset/util_unistr.c +++ b/lib/util/charset/util_unistr.c @@ -483,7 +483,7 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n) return NULL; } - while (*src && n--) { + while (n-- && *src) { size_t c_size; codepoint_t c = next_codepoint_convenience(iconv_convenience, src, &c_size); src += c_size; -- cgit