xt_psd: avoid crash due to curr->next corruption
Florian Westphal
maintainerPATCH 1/1 xt_psd: avoid crash due to curr->next corruption
curr->ports[] is of size SCAN_MAX_COUNT - 1, so under certain conditions we wrote past end of array, corrupting ->next pointer of the adjacent host entry.
Reported-and-tested-by Serge Leschinsky <[email protected]>
--- extensions/xt_psd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
extensions/xt_psd.c +1 -1
@@ -227,7 +227,7 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match) goto out_match;/* Remember the new port */ -if (curr->count <SCAN_MAX_COUNT ) { +if (curr->count <ARRAY_SIZE (curr->ports)) { curr->ports[curr->count].number = dest_port; curr->ports[curr->count].proto = proto; curr->ports[curr->count].and_flags = tcp_flags;
Signature · 1 line
1.7.3.4
Quoted 3 lines · Florian Westphal
curr->ports[] is of size
SCAN_MAX_COUNT- 1, so under certain conditions we wrote past end of array, corrupting ->next pointer of the adjacent host entry.
Processed.