From acdae19a6547c675cb18551a637ad53d5f1b994c Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Wed, 11 Mar 2009 03:35:29 +0000 Subject: [PATCH] Fix bug where wcscspn could return non-zero value on an empty string. svn path=/trunk/; revision=39945 --- reactos/lib/sdk/crt/wstring/wcscspn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/lib/sdk/crt/wstring/wcscspn.c b/reactos/lib/sdk/crt/wstring/wcscspn.c index 1fcad259b43..a68dd776385 100644 --- a/reactos/lib/sdk/crt/wstring/wcscspn.c +++ b/reactos/lib/sdk/crt/wstring/wcscspn.c @@ -18,7 +18,7 @@ size_t wcscspn(const wchar_t *str,const wchar_t *reject) wchar_t *s; wchar_t *t; s=(wchar_t *)str; - do { + while (*s) { t=(wchar_t *)reject; while (*t) { if (*t==*s) @@ -28,6 +28,6 @@ size_t wcscspn(const wchar_t *str,const wchar_t *reject) if (*t) break; s++; - } while (*s); + } return s-str; /* nr of wchars */ }