* miscfuncs.cc (cygwin_strncasecmp): Fix bug which results in
prematurely truncated strings. Simplify target length argument to sys_mbstowcs.
This commit is contained in:
parent
88d1b6df94
commit
bf216dcad6
|
@ -1,3 +1,9 @@
|
||||||
|
2008-07-14 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* miscfuncs.cc (cygwin_strncasecmp): Fix bug which results in
|
||||||
|
prematurely truncated strings. Simplify target length argument to
|
||||||
|
sys_mbstowcs.
|
||||||
|
|
||||||
2008-07-14 Corinna Vinschen <corinna@vinschen.de>
|
2008-07-14 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* autoload.cc (GetExtendedTcpTable): Define.
|
* autoload.cc (GetExtendedTcpTable): Define.
|
||||||
|
|
|
@ -130,16 +130,14 @@ cygwin_strncasecmp (const char *cs, const char *ct, size_t n)
|
||||||
|
|
||||||
while (cs[ls] && ls < n)
|
while (cs[ls] && ls < n)
|
||||||
++ls;
|
++ls;
|
||||||
len = ls * sizeof (WCHAR);
|
len = (ls + 1) * sizeof (WCHAR);
|
||||||
RtlInitEmptyUnicodeString (&us, (PWCHAR) alloca (len), len);
|
RtlInitEmptyUnicodeString (&us, (PWCHAR) alloca (len), len);
|
||||||
us.Length = sys_mbstowcs (us.Buffer, us.MaximumLength / sizeof (WCHAR),
|
us.Length = sys_mbstowcs (us.Buffer, ls + 1, cs, ls) * sizeof (WCHAR);
|
||||||
cs, ls) * sizeof (WCHAR);
|
|
||||||
while (ct[lt] && lt < n)
|
while (ct[lt] && lt < n)
|
||||||
++lt;
|
++lt;
|
||||||
len = lt * sizeof (WCHAR);
|
len = (lt + 1) * sizeof (WCHAR);
|
||||||
RtlInitEmptyUnicodeString (&ut, (PWCHAR) alloca (len), len);
|
RtlInitEmptyUnicodeString (&ut, (PWCHAR) alloca (len), len);
|
||||||
ut.Length = sys_mbstowcs (ut.Buffer, ut.MaximumLength / sizeof (WCHAR),
|
ut.Length = sys_mbstowcs (ut.Buffer, lt + 1, ct, lt) * sizeof (WCHAR);
|
||||||
ct, lt) * sizeof (WCHAR);
|
|
||||||
return RtlCompareUnicodeString (&us, &ut, TRUE);
|
return RtlCompareUnicodeString (&us, &ut, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue