Don't allow negative offsets when reading the message buffer, because it
can allow reading arbitrary kernel memory.
This commit is contained in:
parent
0bd65b04de
commit
218f69d99f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kernfs_vnops.c,v 1.110 2005/08/30 20:08:01 xtraeme Exp $ */
|
||||
/* $NetBSD: kernfs_vnops.c,v 1.111 2005/08/31 09:54:54 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.110 2005/08/30 20:08:01 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.111 2005/08/31 09:54:54 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ipsec.h"
|
||||
@ -427,6 +427,10 @@ kernfs_xread(kfs, off, bufp, len, wrlen)
|
||||
* message buffer header are corrupted, but that'll cause
|
||||
* the system to die anyway.
|
||||
*/
|
||||
if (off < 0) {
|
||||
*wrlen = 0;
|
||||
return EINVAL;
|
||||
}
|
||||
if (off >= msgbufp->msg_bufs) {
|
||||
*wrlen = 0;
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user