From c889c29d0d816a2f5641dabaa4c3c7ebdc60b5a8 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 27 Jan 2002 16:37:12 +0000 Subject: minor fix and checks (This used to be commit a034bfb9ef7a4c8a127ac91f4163cc6af98f29b3) --- source3/lib/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/lib/util.c b/source3/lib/util.c index d548f48e85..021f8c0edf 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -429,6 +429,7 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) smb_ucs2_t *p, *r, *t; DEBUG(3, ("unix_clean_path\n")); /* [%unicode]\n")); */ + if(!s) return NULL; /* convert '\' to '/' */ ns = strdup_w(s); @@ -461,8 +462,8 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) } } - /* remove any trailing /. */ - trim_string_wa(ns, NULL, "/."); + /* remove any leading ./ trailing /. */ + trim_string_wa(ns, "./", "/."); /* remove any leading and trailing / */ trim_string_wa(ns, "/", "/"); @@ -1916,6 +1917,7 @@ BOOL ms_has_wild(char *s) BOOL ms_has_wild_w(const smb_ucs2_t *s) { smb_ucs2_t c; + if (!s) return False; while ((c = *s++)) { switch (c) { case UCS2_CHAR('*'): -- cgit