[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
parent b7e01c09b5
commit 7eee358d7a
2 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,10 @@
- djm@cvs.openbsd.org 2014/01/19 04:48:08 - djm@cvs.openbsd.org 2014/01/19 04:48:08
[ssh_config.5] [ssh_config.5]
fix inverted meaning of 'no' and 'yes' for CanonicalizeFallbackLocal 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 20140118
- (dtucker) [uidswap.c] Prevent unused variable warnings on Cygwin. Patch - (dtucker) [uidswap.c] Prevent unused variable warnings on Cygwin. Patch

View File

@ -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> * 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) { switch (sa->sa_family) {
case AF_INET: case AF_INET:
if ((size_t)slen < sizeof(*in4)) if (slen < (socklen_t)sizeof(*in4))
return -1; return -1;
xa->af = AF_INET; xa->af = AF_INET;
memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4)); memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4));
break; break;
case AF_INET6: case AF_INET6:
if ((size_t)slen < sizeof(*in6)) if (slen < (socklen_t)sizeof(*in6))
return -1; return -1;
xa->af = AF_INET6; xa->af = AF_INET6;
memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6)); memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6));