]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_condition: use `xt_check_proc_name` to validate /proc file name
authorJeremy Sowden <jeremy@azazel.net>
Sun, 22 Aug 2021 16:35:51 +0000 (17:35 +0100)
committerJan Engelhardt <jengelh@inai.de>
Sun, 22 Aug 2021 19:39:36 +0000 (21:39 +0200)
4.16 introduced a standard function to do the job, so let's use it.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
extensions/xt_condition.c

index c2c48670c7889f52b08b681b4592e3dbb0153399..1d9d7352f06991e00f820c731cb082419ca6a7bd 100644 (file)
@@ -135,9 +135,7 @@ static int condition_mt_check(const struct xt_mtchk_param *par)
        struct condition_net *condition_net = condition_pernet(par->net);
 
        /* Forbid certain names */
-       if (*info->name == '\0' || *info->name == '.' ||
-           info->name[sizeof(info->name)-1] != '\0' ||
-           memchr(info->name, '/', sizeof(info->name)) != NULL) {
+       if (xt_check_proc_name(info->name, sizeof(info->name))) {
                printk(KERN_INFO KBUILD_MODNAME ": name not allowed or too "
                       "long: \"%.*s\"\n", (unsigned int)sizeof(info->name),
                       info->name);