DragonFlyBSD Kernel Audit
DF-0029 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/vfs_journal.c b/sys/kern/vfs_journal.c
--- a/sys/kern/vfs_journal.c
+++ b/sys/kern/vfs_journal.c
@@ -1090,7 +1090,8 @@
 	    bcopy(buf, jrec->stream_ptr, jrec->stream_residual);
 	    break;
 	case JDATA_USER:
-	    copyin(buf, jrec->stream_ptr, jrec->stream_residual);
+	    if (copyin(buf, jrec->stream_ptr, jrec->stream_residual) != 0)
+		bzero(jrec->stream_ptr, jrec->stream_residual);
 	    break;
 	case JDATA_XIO:
 	    xio_copy_xtok((xio_t)buf, xio_offset, jrec->stream_ptr,
@@ -1137,7 +1138,8 @@
 	    bcopy(buf, jrec->stream_ptr, bytes);
 	    break;
 	case JDATA_USER:
-	    copyin(buf, jrec->stream_ptr, bytes);
+	    if (copyin(buf, jrec->stream_ptr, bytes) != 0)
+		bzero(jrec->stream_ptr, bytes);
 	    break;
 	case JDATA_XIO:
 	    xio_copy_xtok((xio_t)buf, xio_offset, jrec->stream_ptr, bytes);