From: Mike Yuan Date: Fri, 19 Apr 2024 23:17:04 +0000 (+0800) Subject: shared/vpick: check deterministic suffix earlier X-Git-Tag: v256-rc1~92^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F32370%2Fhead;p=thirdparty%2Fsystemd.git shared/vpick: check deterministic suffix earlier Follow-up for 421a4ba7e4a26332c271359a7a114a1da7a2afad --- diff --git a/src/shared/vpick.c b/src/shared/vpick.c index fe332189be5..4720e7448d8 100644 --- a/src/shared/vpick.c +++ b/src/shared/vpick.c @@ -34,6 +34,8 @@ static int format_fname( if (FLAGS_SET(flags, PICK_TRIES) || !filter->version) /* Underspecified? */ return -ENOEXEC; + if (strv_length(filter->suffix) > 1) /* suffix is not deterministic? */ + return -ENOEXEC; /* The format for names we match goes like this: * @@ -85,13 +87,9 @@ static int format_fname( return -ENOMEM; } - if (!strv_isempty(filter->suffix)) { - if (strv_length(filter->suffix) > 1) - return -ENOEXEC; - + if (!strv_isempty(filter->suffix)) if (!strextend(&fn, filter->suffix[0])) return -ENOMEM; - } if (!filename_is_valid(fn)) return -EINVAL;