mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-18 13:52:53 -04:00
build-init/finish: Validate extension names
Otherwise, it becomes easy to accidentally create extensions with invalid names. Ref #3887.
This commit is contained in:
committed by
Alexander Larsson
parent
9959fd80e9
commit
719eeee461
@@ -588,6 +588,12 @@ update_metadata (GFile *base, FlatpakContext *arg_context, gboolean is_runtime,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!flatpak_is_valid_name (elements[0], error))
|
||||
{
|
||||
glnx_prefix_error (error, _("Invalid extension name %s"), elements[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
groupname = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION,
|
||||
elements[0], NULL);
|
||||
|
||||
|
||||
@@ -449,6 +449,9 @@ flatpak_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
||||
if (g_strv_length (elements) < 2)
|
||||
return flatpak_fail (error, _("Too few elements in --extension argument %s, format should be NAME=VAR[=VALUE]"), opt_extensions[i]);
|
||||
|
||||
if (!flatpak_is_valid_name (elements[0], error))
|
||||
return glnx_prefix_error (error, _("Invalid extension name %s"), elements[0]);
|
||||
|
||||
groupname = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION,
|
||||
elements[0], NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user