Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netsmb Reject negative offset/count for smb read/write.
details: https://anonhg.NetBSD.org/src/rev/f87a6d8a982b
branches: trunk
changeset: 355396:f87a6d8a982b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Jul 28 14:45:59 2017 +0000
description:
Reject negative offset/count for smb read/write.
Not clear that this is actually a problem for the kernel -- might
overwrite user's buffers or return garbage to user, but that's their
own damn fault. But it's hard to imagine that negative offset/count
ever makes sense, and I haven't ruled out a problem for the kernel.
diffstat:
sys/netsmb/smb_dev.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 337f14104ac8 -r f87a6d8a982b sys/netsmb/smb_dev.c
--- a/sys/netsmb/smb_dev.c Fri Jul 28 14:40:42 2017 +0000
+++ b/sys/netsmb/smb_dev.c Fri Jul 28 14:45:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smb_dev.c,v 1.49 2016/07/18 21:03:01 pgoyette Exp $ */
+/* $NetBSD: smb_dev.c,v 1.50 2017/07/28 14:45:59 riastradh Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.49 2016/07/18 21:03:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.50 2017/07/28 14:45:59 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -345,6 +345,8 @@
struct uio auio;
struct iovec iov;
+ if (rwrq->ioc_cnt < 0 || rwrq->ioc_offset < 0)
+ return EINVAL;
if ((ssp = sdp->sd_share) == NULL)
return ENOTCONN;
iov.iov_base = rwrq->ioc_base;
Home |
Main Index |
Thread Index |
Old Index