My previous patch was not thought out completely and so the new bti
crashes if fed an input without a newline, like this:
echo -n "status test" | bti
The obvious fix seems the most appropriate approach in this case.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
if (!fgets(string, 999, stdin))
return NULL;
temp = strchr(string, '\n');
- *temp = '\0';
+ if (temp)
+ *temp = '\0';
return string;
}
if (!fgets(string, 999, stdin))
return NULL;
temp = strchr(string, '\n');
- *temp = '\0';
+ if (temp)
+ *temp = '\0';
return string;
}