[git commit] libbb/procps.c: make fast_strtoul_10() stop on '\n' too

Denys Vlasenko vda.linux at googlemail.com
Tue Feb 28 02:36:49 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=0b170e6a096b0d5010e29a39f3b270c3a7bc4945
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

This is needed for parsing /proc data on linux 2.4

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/procps.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libbb/procps.c b/libbb/procps.c
index 0e3f2f9..c06ff1d 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -127,7 +127,8 @@ static unsigned long fast_strtoul_16(char **endptr)
 	char *str = *endptr;
 	unsigned long n = 0;
 
-	while ((c = *str++) != ' ') {
+	/* need to stop on both ' ' and '\n' */
+	while ((c = *str++) > ' ') {
 		c = ((c|0x20) - '0');
 		if (c > 9)
 			// c = c + '0' - 'a' + 10:


More information about the busybox-cvs mailing list