From 03f76092bdb6c011e539a125729efe330227f8b2 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 12 Aug 2010 00:48:44 -0400 Subject: [PATCH] Windows: comparisons of nul strings should match When comparing nul strings in cm_strnicmp_utf8 and cm_strnicmp_utf16 the functions should return 0. LICENSE MIT Change-Id: I30c1321f42135a5e0160407467549b13cc92393f Reviewed-on: http://gerrit.openafs.org/2539 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_nls.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WINNT/afsd/cm_nls.c b/src/WINNT/afsd/cm_nls.c index 02903cfc85..20f1420106 100644 --- a/src/WINNT/afsd/cm_nls.c +++ b/src/WINNT/afsd/cm_nls.c @@ -1113,6 +1113,9 @@ int cm_strnicmp_utf8(const char * str1, const char * str2, int n) if (!nls_init) cm_InitNormalization(); + if (n == 0) + return 0; + /* first check for NULL pointers (assume NULL < "") */ if (str1 == NULL) { if (str2 == NULL) @@ -1159,6 +1162,9 @@ int cm_strnicmp_utf16(const cm_unichar_t * str1, const cm_unichar_t * str2, int if (!nls_init) cm_InitNormalization(); + if (len == 0) + return 0; + /* first check for NULL pointers */ if (str1 == NULL) { if (str2 == NULL)