Module Name: src
Committed By: snj
Date: Sat May 30 16:47:30 UTC 2009
Modified Files:
src/usr.sbin/puffs/mount_sysctlfs [netbsd-5-0]: sysctlfs.c
Log Message:
Pull up following revision(s) (requested by njoly in ticket #783):
usr.sbin/puffs/mount_sysctlfs/sysctlfs.c: revision 1.11
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.9 -r1.9.6.1 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.9 src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.9.6.1
--- src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.9 Fri Sep 12 14:40:47 2008
+++ src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c Sat May 30 16:47:30 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctlfs.c,v 1.9 2008/09/12 14:40:47 christos Exp $ */
+/* $NetBSD: sysctlfs.c,v 1.9.6.1 2009/05/30 16:47:30 snj 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.9 2008/09/12 14:40:47 christos Exp $");
+__RCSID("$NetBSD: sysctlfs.c,v 1.9.6.1 2009/05/30 16:47:30 snj Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -629,7 +629,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;