From 114eaabdcbacf626ccb452a2d4f695b183dd738b Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 25 Jan 2002 00:35:14 +0000 Subject: minor fixes (This used to be commit 04f492980b73800b60dde764fdeb43f2eab79624) --- source3/lib/util.c | 5 +++-- source3/lib/util_str.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 97ff4e24a0..2b71b3cb3d 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -449,13 +449,14 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s) /* reduce any /../ */ t = ns; - while ((r = strstr_wa(t, "/.."))) { + while (*t && (r = strstr_wa(t, "/.."))) { t = &(r[3]); if (*t == UCS2_CHAR('/') || *t == 0) { *r = 0; p = strrchr_w(ns, UCS2_CHAR('/')); if (!p) p = ns; - memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t)); + if (*t == 0) *p = 0; + else memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t)); t = p; } } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index dbfaf179a1..a7eeedea3d 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -3,6 +3,7 @@ Version 3.0 Samba utility functions Copyright (C) Andrew Tridgell 1992-2001 + Copyright (C) Simo Sorce 2001-2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -749,8 +750,8 @@ len is the number of bytes, not chars if len==0 then no length check is performed ****************************************************************************/ -smb_ucs2_t *all_string_sub_w(smb_ucs2_t *s, const smb_ucs2_t *pattern, - const smb_ucs2_t *insert) +smb_ucs2_t *all_string_sub_w(const smb_ucs2_t *s, const smb_ucs2_t *pattern, + const smb_ucs2_t *insert) { smb_ucs2_t *r, *rp, *sp; size_t lr, lp, li, lt; @@ -951,7 +952,7 @@ int pstr_sprintf(pstring s, const char *fmt, ...) } -/* Just a typesafety wrapper for snprintf into a pstring */ +/* Just a typesafety wrapper for snprintf into a fstring */ int fstr_sprintf(fstring s, const char *fmt, ...) { va_list ap; -- cgit