Skip to content

Commit

Permalink
recvmmsg(2): More timespec validation.
Browse files Browse the repository at this point in the history
Reported-by: syzbot+004ed2f264534bd27312@syzkaller.appspotmail.com
Reported-by: syzbot+6f9014c842c4e78df7bc@syzkaller.appspotmail.com
  • Loading branch information
riastradh authored and riastradh committed Jun 29, 2022
1 parent 1d15b65 commit 330d9a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.204 2022/06/28 11:41:32 riastradh Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $ */

/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -61,7 +61,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.204 2022/06/28 11:41:32 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $");

#ifdef _KERNEL_OPT
#include "opt_pipe.h"
Expand Down Expand Up @@ -1041,6 +1041,8 @@ sys_recvmmsg(struct lwp *l, const struct sys_recvmmsg_args *uap,
if (SCARG(uap, timeout)) {
if ((error = copyin(SCARG(uap, timeout), &ts, sizeof(ts))) != 0)
return error;
if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000L)
return EINVAL;
getnanotime(&now);
if (timespecaddok(&now, &ts)) {
timespecadd(&now, &ts, &ts);
Expand Down

0 comments on commit 330d9a1

Please sign in to comment.