Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as...
details: https://anonhg.NetBSD.org/src/rev/fa9d8adb7d2e
branches: trunk
changeset: 965892:fa9d8adb7d2e
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Oct 04 23:20:22 2019 +0000
description:
Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX
This logic (found in Linux) avoids undefined behavior.
Reported-by: syzbot+8af00519a8688d9903ca%syzkaller.appspotmail.com@localhost
diffstat:
sys/kern/sysv_msg.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 8269f7688492 -r fa9d8adb7d2e sys/kern/sysv_msg.c
--- a/sys/kern/sysv_msg.c Fri Oct 04 23:06:19 2019 +0000
+++ b/sys/kern/sysv_msg.c Fri Oct 04 23:20:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysv_msg.c,v 1.75 2019/08/07 00:38:02 pgoyette Exp $ */
+/* $NetBSD: sysv_msg.c,v 1.76 2019/10/04 23:20:22 kamil Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.75 2019/08/07 00:38:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.76 2019/10/04 23:20:22 kamil Exp $");
#ifdef _KERNEL_OPT
#include "opt_sysv.h"
@@ -1100,6 +1100,7 @@
*/
if (msgtyp != msghdr->msg_type &&
+ msgtyp != LONG_MIN &&
msghdr->msg_type > -msgtyp)
continue;
Home |
Main Index |
Thread Index |
Old Index