Project

General

Profile

Actions

Bug #8543

open
UK UK

decode/tcp: avoid unaligned access in TCP option parsing

Bug #8543: decode/tcp: avoid unaligned access in TCP option parsing

Added by Urval Kheni 4 days ago. Updated 4 days ago.

Status:
In Review
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:
C, Hardening, Protocol

Description

TCP option parsing in decode-tcp.c currently performs direct uint16_t pointer casts on byte-packed TCP option data.

Since TCP options are not guaranteed to be naturally aligned, this can cause unaligned memory access on strict-alignment architectures and also relies on undefined behavior in C.

Affected parsing paths include MSS and EXP/TFO option handling.

The proposed fix replaces direct casts with explicit byte-wise 16-bit extraction while preserving existing parsing behavior.

A pull request with the fix is already available:
https://github.com/OISF/suricata/pull/15207

Actions

Also available in: PDF Atom