提交 84c95c9a 编写于 作者: A André Goddard Rosa 提交者: 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: NAndré Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f653398c
......@@ -364,8 +364,8 @@ char *strstrip(char *s)
size_t size;
char *end;
s = skip_spaces(s);
size = strlen(s);
if (!size)
return s;
......@@ -374,7 +374,7 @@ char *strstrip(char *s)
end--;
*(end + 1) = '\0';
return skip_spaces(s);
return s;
}
EXPORT_SYMBOL(strstrip);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册