[OpenBIOS] r598 - trunk/openbios-devel/modules

svn at openbios.org svn at openbios.org
Fri Nov 6 22:59:24 CET 2009


Author: laurent
Date: 2009-11-06 21:59:24 +0000 (Fri, 06 Nov 2009)
New Revision: 598

Modified:
   trunk/openbios-devel/modules/client.c
Log:
Client Interface: manage arguments number overflow

Signed-off-by: Laurent Vivier <Laurent at vivier.eu>


Modified: trunk/openbios-devel/modules/client.c
===================================================================
--- trunk/openbios-devel/modules/client.c	2009-11-06 21:23:32 UTC (rev 597)
+++ trunk/openbios-devel/modules/client.c	2009-11-06 21:59:24 UTC (rev 598)
@@ -29,11 +29,12 @@
  * (it doesn't) or if the function is unimplemented.
  */
 
+#define PROM_MAX_ARGS	10
 typedef struct prom_args {
         const char 	*service;
         long 		nargs;
         long 		nret;
-        ulong 		args[10];		/* MAX NUM ARGS! */
+        ulong 		args[PROM_MAX_ARGS];
 } prom_args_t;
 
 #ifdef DEBUG_CIF
@@ -258,7 +259,8 @@
 	prom_args_t *pb = (prom_args_t*)params;
 	int val, i, dstacksave;
 
-	if( pb->nargs < 0 || pb->nret < 0 )
+	if( pb->nargs < 0 || pb->nret < 0 ||
+            pb->nargs + pb->nret > PROM_MAX_ARGS)
 		return -1;
 #ifdef DEBUG_CIF
 	dump_service(pb);




More information about the OpenBIOS mailing list