cgfsng: make trim() safer

parent fb8df267
......@@ -986,7 +986,7 @@ static void get_existing_subsystems(char ***klist, char ***nlist)
static void trim(char *s)
{
size_t len = strlen(s);
while (s[len-1] == '\n')
while ((len > 1) && (s[len - 1] == '\n'))
s[--len] = '\0';
}
......
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