[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 2/3] sysctl: abort reading on NULL keys
From:       Jeremy Kerr <jk () ozlabs ! org>
Date:       2007-11-28 3:11:24
Message-ID: 1196219484.649981.37995970470.qpush () pokey
[Download RAW message or body]

At present, sysctl_read_setting() detects NULL keys, but keeps
processing regardless.

This change aborts the read on NULL keys.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

--
bloat-o-meter results on powerpc:
function                                             old     new   delta
sysctl_read_setting                                  460     468      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0)                 Total: 8 bytes


---

 procps/sysctl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: busybox/procps/sysctl.c
===================================================================
--- busybox.orig/procps/sysctl.c
+++ busybox/procps/sysctl.c
@@ -249,8 +249,10 @@ static int sysctl_read_setting(const cha
 	const char *name;
 	FILE *fp;
 
-	if (!*setting)
+	if (!*setting) {
 		bb_error_msg(ERR_INVALID_KEY, setting);
+		return -1;
+	}
 
 	name = setting;
 	tmpname = concat_path_file(PROC_SYS, name);
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic