Module Name: src
Committed By: njoly
Date: Thu May 28 10:07:06 UTC 2009
Modified Files:
src/usr.sbin/puffs/mount_sysctlfs: sysctlfs.c
Log Message:
Fix a crash while trying to read nodes on amd64, reported in PR/41494,
by not doing any transfert when offset exceed the actual data length.
>From and ok by po...@.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c
diff -u src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.10 src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.11
--- src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.10 Sun Jan 18 10:10:47 2009
+++ src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c Thu May 28 10:07:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctlfs.c,v 1.10 2009/01/18 10:10:47 lukem Exp $ */
+/* $NetBSD: sysctlfs.c,v 1.11 2009/05/28 10:07:06 njoly Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: sysctlfs.c,v 1.10 2009/01/18 10:10:47 lukem Exp $");
+__RCSID("$NetBSD: sysctlfs.c,v 1.11 2009/05/28 10:07:06 njoly Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -627,7 +627,10 @@
return EISDIR;
doprint(sfs, &pn->pn_po, localbuf, sizeof(localbuf));
- xfer = MIN(*resid, strlen(localbuf) - offset);
+ if (strlen(localbuf) < offset)
+ xfer = 0;
+ else
+ xfer = MIN(*resid, strlen(localbuf) - offset);
if (xfer <= 0)
return 0;