41 lines
1.7 KiB
Diff
41 lines
1.7 KiB
Diff
From 07ab8c7e7a1eeb6a5bb4028d92d713034df39167 Mon Sep 17 00:00:00 2001
|
|
From: Phil Sutter <phil@nwl.cc>
|
|
Date: Sun, 17 Dec 2023 13:02:36 +0100
|
|
Subject: [PATCH] libxtables: xtoptions: Prevent XTOPT_PUT with XTTYPE_HOSTMASK
|
|
|
|
Do as the comment in xtopt_parse_hostmask() claims and omit
|
|
XTTYPE_HOSTMASK from xtopt_psize array so xtables_option_metavalidate()
|
|
will catch the incompatibility.
|
|
|
|
Fixes: 66266abd17adc ("libxtables: XTTYPE_HOSTMASK support")
|
|
(cherry picked from commit 17d724f20e3c97ea8ce8765ca532a3cf49a98b31)
|
|
---
|
|
include/xtables.h | 1 -
|
|
libxtables/xtoptions.c | 1 -
|
|
2 files changed, 2 deletions(-)
|
|
|
|
diff --git a/include/xtables.h b/include/xtables.h
|
|
index 087a1d600f9ae..9def9b43b6e58 100644
|
|
--- a/include/xtables.h
|
|
+++ b/include/xtables.h
|
|
@@ -61,7 +61,6 @@ struct in_addr;
|
|
* %XTTYPE_SYSLOGLEVEL: syslog level by name or number
|
|
* %XTTYPE_HOST: one host or address (ptr: union nf_inet_addr)
|
|
* %XTTYPE_HOSTMASK: one host or address, with an optional prefix length
|
|
- * (ptr: union nf_inet_addr; only host portion is stored)
|
|
* %XTTYPE_PROTOCOL: protocol number/name from /etc/protocols (ptr: uint8_t)
|
|
* %XTTYPE_PORT: 16-bit port name or number (supports %XTOPT_NBO)
|
|
* %XTTYPE_PORTRC: colon-separated port range (names acceptable),
|
|
diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
|
|
index d91a78f470eda..ba68056dc99f7 100644
|
|
--- a/libxtables/xtoptions.c
|
|
+++ b/libxtables/xtoptions.c
|
|
@@ -57,7 +57,6 @@ static const size_t xtopt_psize[] = {
|
|
[XTTYPE_STRING] = -1,
|
|
[XTTYPE_SYSLOGLEVEL] = sizeof(uint8_t),
|
|
[XTTYPE_HOST] = sizeof(union nf_inet_addr),
|
|
- [XTTYPE_HOSTMASK] = sizeof(union nf_inet_addr),
|
|
[XTTYPE_PROTOCOL] = sizeof(uint8_t),
|
|
[XTTYPE_PORT] = sizeof(uint16_t),
|
|
[XTTYPE_PORTRC] = sizeof(uint16_t[2]),
|