mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-11-23 09:17:32 +08:00
Fix signedness bug in Cygwin code
The Cygwin-specific pattern match code has a bug. It checks the size_t value returned by mbstowcs for being < 0. The right thing to do is to check against (size_t) -1. Fix that. Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
This commit is contained in:
parent
2e5cfed513
commit
68085066b6
@ -194,11 +194,11 @@ _match_pattern(const char *s, const char *pattern)
|
||||
size_t len;
|
||||
int ret;
|
||||
|
||||
if ((len = mbstowcs(NULL, s, 0)) < 0)
|
||||
if ((len = mbstowcs(NULL, s, 0)) == (size_t) -1)
|
||||
return 0;
|
||||
ws = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t));
|
||||
mbstowcs(ws, s, len + 1);
|
||||
if ((len = mbstowcs(NULL, pattern, 0)) < 0)
|
||||
if ((len = mbstowcs(NULL, pattern, 0)) == (size_t) -1)
|
||||
return 0;
|
||||
wpattern = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t));
|
||||
mbstowcs(wpattern, pattern, len + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user