From: Jeffrey Altman Date: Thu, 12 Aug 2010 04:48:44 +0000 (-0400) Subject: Windows: comparisons of nul strings should match X-Git-Tag: openafs-devel-1_5_76~13 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=03f76092bdb6c011e539a125729efe330227f8b2;p=packages%2Fo%2Fopenafs.git 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 --- diff --git a/src/WINNT/afsd/cm_nls.c b/src/WINNT/afsd/cm_nls.c index 02903cfc8..20f142010 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)