mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-12 21:40:33 +01:00
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>
This commit is contained in:
parent
ccc912e870
commit
93131b1df2
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue