Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Ensure failure if resid goes negative.
details: https://anonhg.NetBSD.org/src/rev/18b9a6f22ef6
branches: trunk
changeset: 454767:18b9a6f22ef6
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Fri Sep 27 08:17:11 2019 +0000
description:
Ensure failure if resid goes negative.
diffstat:
sys/compat/netbsd32/netbsd32_socket.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 3776bcfdfc39 -r 18b9a6f22ef6 sys/compat/netbsd32/netbsd32_socket.c
--- a/sys/compat/netbsd32/netbsd32_socket.c Fri Sep 27 08:12:01 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_socket.c Fri Sep 27 08:17:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_socket.c,v 1.51 2019/09/27 08:12:01 mlelstv Exp $ */
+/* $NetBSD: netbsd32_socket.c,v 1.52 2019/09/27 08:17:11 mlelstv Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.51 2019/09/27 08:12:01 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.52 2019/09/27 08:17:11 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -403,7 +403,8 @@
/*
* Sanity check the control message length.
*/
- if (cmsg32.cmsg_len > (size_t)resid ||
+ if (resid < 0 ||
+ cmsg32.cmsg_len > (size_t)resid ||
cmsg32.cmsg_len < sizeof(cmsg32)) {
error = EINVAL;
goto failure;
Home |
Main Index |
Thread Index |
Old Index