Explorar o código

netfilter: ebtables: abort if next_offset is too small

next_offset must be > 0, otherwise this loops forever.
The offset also contains the size of the ebt_entry structure
itself, so anything smaller is invalid.

Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Florian Westphal %!s(int64=16) %!d(string=hai) anos
pai
achega
1756de262e
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      net/bridge/netfilter/ebtables.c

+ 2 - 0
net/bridge/netfilter/ebtables.c

@@ -444,6 +444,8 @@ static int ebt_verify_pointers(const struct ebt_replace *repl,
 				break;
 			if (left < e->next_offset)
 				break;
+			if (e->next_offset < sizeof(struct ebt_entry))
+				return -EINVAL;
 			offset += e->next_offset;
 		}
 	}