occtl: avoid crash on empty cmdline argument

This commit is contained in:
Nikos Mavrogiannopoulos
2015-02-26 20:59:03 +01:00
parent 056730e931
commit e64528c9f1

View File

@@ -121,7 +121,7 @@ unsigned need_help(const char *arg)
unsigned check_cmd_help(const char *line)
{
unsigned int i;
unsigned len = strlen(line);
unsigned len = (line!=NULL)?strlen(line):0;
unsigned status = 0, tlen;
while (len > 0 && (line[len - 1] == '?' || whitespace(line[len - 1])))