svn commit: samba r17980 - in
branches/SAMBA_4_0/source/lib/charset: .
tridge at samba.org
tridge at samba.org
Fri Sep 1 04:23:25 GMT 2006
Author: tridge
Date: 2006-09-01 04:23:24 +0000 (Fri, 01 Sep 2006)
New Revision: 17980
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17980
Log:
handle NULL arguments without crashing in strcasecmp_m() and
strncasecmp_m(). This makes the use of these functions in sorting
routines with RPC replies sane
Modified:
branches/SAMBA_4_0/source/lib/charset/util_unistr.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/charset/util_unistr.c
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/util_unistr.c 2006-09-01 04:15:04 UTC (rev 17979)
+++ branches/SAMBA_4_0/source/lib/charset/util_unistr.c 2006-09-01 04:23:24 UTC (rev 17980)
@@ -123,6 +123,11 @@
codepoint_t c1=0, c2=0;
size_t size1, size2;
+ /* handle null ptr comparisons to simplify the use in qsort */
+ if (s1 == s2) return 0;
+ if (s1 == NULL) return -1;
+ if (s2 == NULL) return 1;
+
while (*s1 && *s2) {
c1 = next_codepoint(s1, &size1);
c2 = next_codepoint(s2, &size2);
@@ -202,6 +207,11 @@
codepoint_t c1=0, c2=0;
size_t size1, size2;
+ /* handle null ptr comparisons to simplify the use in qsort */
+ if (s1 == s2) return 0;
+ if (s1 == NULL) return -1;
+ if (s2 == NULL) return 1;
+
while (*s1 && *s2 && n) {
n--;
More information about the samba-cvs
mailing list