diff options
author | Thomas Haller <thaller@redhat.com> | 2013-11-11 14:43:50 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-11-11 15:27:30 +0100 |
commit | 93131b1df2fc2246fed6004d76d3bbff4fcf60e8 (patch) | |
tree | a5fde44db7c4b142791d01eacac86a710ddc741c /cli | |
parent | ccc912e870a342ea25220497fedc06af309cfee7 (diff) | |
download | NetworkManager-93131b1df2fc2246fed6004d76d3bbff4fcf60e8.tar.gz |
cli: fix in matching command line arguments
Ensure in matches() that a non-empty cmd is given, otherwise
as currently
nmcli general -
matches to '-h' and is thus treated as
nmcli general -h
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/src/utils.c b/cli/src/utils.c index da38769798..61fbff8c3c 100644 --- a/cli/src/utils.c +++ b/cli/src/utils.c @@ -38,8 +38,8 @@ int matches (const char *cmd, const char *pattern) { - int len = strlen (cmd); - if (len > strlen (pattern)) + size_t len = strlen (cmd); + if (!len || len > strlen (pattern)) return -1; return memcmp (pattern, cmd, len); } |