From f2815e8412e629e426832ce60457a0f3fec85e4c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 20 Sep 2004 07:31:54 +0000 Subject: r2437: implemented a suggestion from abartlet that if we cannot convert strings to UTF16 in StrCaseCmp() that we fall back to a simpler comparison. (This used to be commit 2fa6ab9fe30aeacd7b1421fd83c409acf31c98aa) --- source4/lib/util_str.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index 961bdb8084..3fe6fd1cc0 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -123,8 +123,11 @@ static int StrCaseCmp_slow(const char *s1, const char *s2) smb_ucs2_t *u1, *u2; int ret; - convert_string_allocate(CH_UNIX, CH_UTF16, s1, strlen(s1)+1, &u1); - convert_string_allocate(CH_UNIX, CH_UTF16, s2, strlen(s2)+1, &u2); + if (convert_string_allocate(CH_UNIX, CH_UTF16, s1, strlen(s1)+1, &u1) == -1 || + convert_string_allocate(CH_UNIX, CH_UTF16, s2, strlen(s2)+1, &u2) == -1) { + /* fallback to a simple comparison */ + return strcasecmp(s1, s2); + } ret = strcasecmp_w(u1, u2); -- cgit