mirror of
https://github.com/tmate-io/tmate.git
synced 2026-07-27 04:50:35 +00:00
Don't access array[-1] if array is an empty string.
OK nicm@
This commit is contained in:
parent
49c776ea59
commit
f60bc7e03b
1 changed files with 2 additions and 2 deletions
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…
Add table
Add a link
Reference in a new issue