mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-16 20:15:11 +00:00
trivial: fu-util/fu-tool: check for '-' in arguments
Make sure if something doesn't look like a duck that it's not a duck.
This commit is contained in:
parent
bc3c241f91
commit
c6009f59fe
@ -645,6 +645,17 @@ fu_util_get_device (FuUtilPrivate *priv, const gchar *id, GError **error)
|
|||||||
return NULL;
|
return NULL;
|
||||||
return fu_util_prompt_for_device (priv, devices, error);
|
return fu_util_prompt_for_device (priv, devices, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* did this look like a GUID? */
|
||||||
|
for (guint i = 0; id[i] != '\0'; i++) {
|
||||||
|
if (id[i] == '-') {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_ARGS,
|
||||||
|
"Invalid arguments");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return fu_engine_get_device (priv->engine, id, error);
|
return fu_engine_get_device (priv->engine, id, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,6 +1040,16 @@ fu_util_get_device_by_id (FuUtilPrivate *priv, const gchar *id, GError **error)
|
|||||||
return NULL;
|
return NULL;
|
||||||
return fu_util_prompt_for_device (priv, devices, error);
|
return fu_util_prompt_for_device (priv, devices, error);
|
||||||
}
|
}
|
||||||
|
/* did this look like a GUID? */
|
||||||
|
for (guint i = 0; id[i] != '\0'; i++) {
|
||||||
|
if (id[i] == '-') {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_ARGS,
|
||||||
|
"Invalid arguments");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return fwupd_client_get_device_by_id (priv->client, id, NULL, error);
|
return fwupd_client_get_device_by_id (priv->client, id, NULL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user