Commit 84c95c9a authored by André Goddard Rosa's avatar André Goddard Rosa Committed by Linus Torvalds

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: default avatarAndré Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f653398c
...@@ -364,8 +364,8 @@ char *strstrip(char *s) ...@@ -364,8 +364,8 @@ char *strstrip(char *s)
size_t size; size_t size;
char *end; char *end;
s = skip_spaces(s);
size = strlen(s); size = strlen(s);
if (!size) if (!size)
return s; return s;
...@@ -374,7 +374,7 @@ char *strstrip(char *s) ...@@ -374,7 +374,7 @@ char *strstrip(char *s)
end--; end--;
*(end + 1) = '\0'; *(end + 1) = '\0';
return skip_spaces(s); return s;
} }
EXPORT_SYMBOL(strstrip); EXPORT_SYMBOL(strstrip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment