Module Name:    src
Committed By:   reinoud
Date:           Fri Sep  9 20:04:43 UTC 2011

Modified Files:
        src/sys/arch/usermode/include: thunk.h
        src/sys/arch/usermode/usermode: thunk.c

Log Message:
Sanitise thunk_makecontext() allowing upto 3 random arguments


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/usermode/usermode/thunk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.31 src/sys/arch/usermode/include/thunk.h:1.32
--- src/sys/arch/usermode/include/thunk.h:1.31	Fri Sep  9 18:41:16 2011
+++ src/sys/arch/usermode/include/thunk.h	Fri Sep  9 20:04:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.31 2011/09/09 18:41:16 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.32 2011/09/09 20:04:43 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca>
@@ -83,8 +83,8 @@
 
 int	thunk_getcontext(ucontext_t *);
 int	thunk_setcontext(const ucontext_t *);
-void	thunk_makecontext(ucontext_t *ucp, void (*func)(void), int nargs,
-		void (*arg1)(void *), void *arg2);
+void	thunk_makecontext(ucontext_t *ucp, void (*func)(void), 
+		int nargs, void *arg1, void *arg2, void *arg3);
 int	thunk_swapcontext(ucontext_t *, ucontext_t *);
 
 int	thunk_tcgetattr(int, struct thunk_termios *);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.35 src/sys/arch/usermode/usermode/thunk.c:1.36
--- src/sys/arch/usermode/usermode/thunk.c:1.35	Fri Sep  9 18:41:16 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Fri Sep  9 20:04:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.35 2011/09/09 18:41:16 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.35 2011/09/09 18:41:16 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $");
 #endif
 
 #include <sys/types.h>
@@ -254,7 +254,7 @@
 
 void
 thunk_makecontext(ucontext_t *ucp, void (*func)(void), 
-    int nargs, void (*arg1)(void *), void *arg2)
+    int nargs, void *arg1, void *arg2, void *arg3)
 {
 	switch (nargs) {
 	case 0:
@@ -266,6 +266,9 @@
 	case 2:
 		makecontext(ucp, func, 2, arg1, arg2);
 		break;
+	case 3:
+		makecontext(ucp, func, 3, arg1, arg2, arg3);
+		break;
 	default:
 		printf("%s: nargs (%d) too big\n", __func__, nargs);
 		abort();

Reply via email to