string: on strstrip(), first remove leading spaces before running over str
... so that strlen() iterates over a smaller string comprising of the
remaining characters only.
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/lib/string.c b/lib/string.c
index 3a912a4..765566a 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -364,8 +364,8 @@
size_t size;
char *end;
+ s = skip_spaces(s);
size = strlen(s);
-
if (!size)
return s;
@@ -374,7 +374,7 @@
end--;
*(end + 1) = '\0';
- return skip_spaces(s);
+ return s;
}
EXPORT_SYMBOL(strstrip);