[addrmatch.c]
     Cast the sizeof to socklen_t so it'll work even if the supplied len is
     negative.  Suggested by and ok djm, ok deraadt.
This commit is contained in:
Darren Tucker 2014-01-19 22:37:02 +11:00
Родитель b7e01c09b5
Коммит 7eee358d7a
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -16,6 +16,10 @@
- djm@cvs.openbsd.org 2014/01/19 04:48:08
[ssh_config.5]
fix inverted meaning of 'no' and 'yes' for CanonicalizeFallbackLocal
- dtucker@cvs.openbsd.org 2014/01/19 11:21:51
[addrmatch.c]
Cast the sizeof to socklen_t so it'll work even if the supplied len is
negative. Suggested by and ok djm, ok deraadt.
20140118
- (dtucker) [uidswap.c] Prevent unused variable warnings on Cygwin. Patch

Просмотреть файл

@ -1,4 +1,4 @@
/* $OpenBSD: addrmatch.c,v 1.8 2014/01/19 04:17:29 dtucker Exp $ */
/* $OpenBSD: addrmatch.c,v 1.9 2014/01/19 11:21:51 dtucker Exp $ */
/*
* Copyright (c) 2004-2008 Damien Miller <djm@mindrot.org>
@ -88,13 +88,13 @@ addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa)
switch (sa->sa_family) {
case AF_INET:
if ((size_t)slen < sizeof(*in4))
if (slen < (socklen_t)sizeof(*in4))
return -1;
xa->af = AF_INET;
memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4));
break;
case AF_INET6:
if ((size_t)slen < sizeof(*in6))
if (slen < (socklen_t)sizeof(*in6))
return -1;
xa->af = AF_INET6;
memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6));