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>
+
* autoload.cc (GetExtendedTcpTable): Define.
* fhandler_socket.cc (address_in_use): Take const struct sockaddr
pointer as argument. Implement additional AF_INET6 table check.
while (cs[ls] && ls < n)
++ls;
- len = ls * sizeof (WCHAR);
+ len = (ls + 1) * sizeof (WCHAR);
RtlInitEmptyUnicodeString (&us, (PWCHAR) alloca (len), len);
- us.Length = sys_mbstowcs (us.Buffer, us.MaximumLength / sizeof (WCHAR),
- cs, ls) * sizeof (WCHAR);
+ us.Length = sys_mbstowcs (us.Buffer, ls + 1, cs, ls) * sizeof (WCHAR);
while (ct[lt] && lt < n)
++lt;
- len = lt * sizeof (WCHAR);
+ len = (lt + 1) * sizeof (WCHAR);
RtlInitEmptyUnicodeString (&ut, (PWCHAR) alloca (len), len);
- ut.Length = sys_mbstowcs (ut.Buffer, ut.MaximumLength / sizeof (WCHAR),
- ct, lt) * sizeof (WCHAR);
+ ut.Length = sys_mbstowcs (ut.Buffer, lt + 1, ct, lt) * sizeof (WCHAR);
return RtlCompareUnicodeString (&us, &ut, TRUE);
}