diff options
author | helg <helg@cvs.openbsd.org> | 2018-01-22 13:16:49 +0000 |
---|---|---|
committer | helg <helg@cvs.openbsd.org> | 2018-01-22 13:16:49 +0000 |
commit | 1fae578f00fafd130693a60c95f129cccab5f302 (patch) | |
tree | 3d63a7a6d015d22829cf339b59015963edbfa890 /sys/miscfs/fuse | |
parent | ea02d263355d87cbde54750af717b2d9b86f9fda (diff) |
Use the proper address space when using a kernel that supports
Supervisor Mode Access Prevention (SMAP) compiled with FUSE_DEBUG.
While here, add some sanity check to the debug function fuse_dump_buff.
Thanks to Thomas Jeunet.
OK mpi@, helg@
Diffstat (limited to 'sys/miscfs/fuse')
-rw-r--r-- | sys/miscfs/fuse/fuse_device.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index 37598169b37..5bbde357c98 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.23 2017/08/10 14:36:34 mestre Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.24 2018/01/22 13:16:48 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -92,6 +92,15 @@ fuse_dump_buff(char *buff, int len) char text[17]; int i; + if (len < 0) { + printf("invalid len: %d", len); + return; + } + if (buff == NULL) { + printf("invalid buff"); + return; + } + bzero(text, 17); for (i = 0; i < len; i++) { if (i != 0 && (i % 16) == 0) { @@ -338,7 +347,7 @@ fuseioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } #ifdef FUSE_DEBUG - fuse_dump_buff(ioexch->fbxch_data, ioexch->fbxch_len); + fuse_dump_buff(fbuf->fb_dat, fbuf->fb_len); #endif /* Adding fbuf in fd_fbufs_wait */ |