mirror of
https://github.com/tmate-io/tmate.git
synced 2025-01-12 08:58:12 +01:00
Don't access array[-1] if array is an empty string.
OK nicm@
This commit is contained in:
parent
49c776ea59
commit
f60bc7e03b
4
arg.c
4
arg.c
@ -76,7 +76,7 @@ arg_parse_client(const char *arg)
|
||||
|
||||
/* Trim a trailing : if any from the argument. */
|
||||
n = strlen(arg2);
|
||||
if (arg2[n - 1] == ':')
|
||||
if (n && arg2[n - 1] == ':')
|
||||
arg2[n - 1] = '\0';
|
||||
|
||||
/* Try and look up the client name. */
|
||||
@ -101,7 +101,7 @@ arg_parse_session(const char *arg)
|
||||
|
||||
/* Trim a trailing : if any from the argument. */
|
||||
n = strlen(arg2);
|
||||
if (arg2[n - 1] == ':')
|
||||
if (n && arg2[n - 1] == ':')
|
||||
arg2[n - 1] = '\0';
|
||||
|
||||
/* See if the argument matches a session. */
|
||||
|
Loading…
Reference in New Issue
Block a user