Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Fix off-by-one in the rpc path of ...
details: https://anonhg.NetBSD.org/src/rev/05a178cbf450
branches: trunk
changeset: 758586:05a178cbf450
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Nov 09 20:55:14 2010 +0000
description:
Fix off-by-one in the rpc path of copyinstr()
diffstat:
sys/rump/librump/rumpkern/rumpcopy.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (38 lines):
diff -r fe7354505549 -r 05a178cbf450 sys/rump/librump/rumpkern/rumpcopy.c
--- a/sys/rump/librump/rumpkern/rumpcopy.c Tue Nov 09 20:44:49 2010 +0000
+++ b/sys/rump/librump/rumpkern/rumpcopy.c Tue Nov 09 20:55:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpcopy.c,v 1.8 2010/11/09 15:22:47 pooka Exp $ */
+/* $NetBSD: rumpcopy.c,v 1.9 2010/11/09 20:55:14 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.8 2010/11/09 15:22:47 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.9 2010/11/09 20:55:14 pooka Exp $");
#include <sys/param.h>
#include <sys/lwp.h>
@@ -103,14 +103,17 @@
uint8_t *to;
int rv;
+ if (len == 0)
+ return 0;
+
if (curproc->p_vmspace == &vmspace0)
return copystr(uaddr, kaddr, len, done);
if ((rv = rumpuser_sp_copyin(uaddr, kaddr, len)) != 0)
return rv;
- /* figure out if we got a terminate string or not */
- to = (uint8_t *)kaddr + len;
+ /* figure out if we got a terminated string or not */
+ to = (uint8_t *)kaddr + (len-1);
while (to != kaddr) {
if (*to == 0)
goto found;
Home |
Main Index |
Thread Index |
Old Index