Crash in MDMF Caller ID parser due to signed char length field on DAHDI channels
The MDMF Caller ID parser in main/callerid.c uses char rawdata[256] to store FSK-demodulated data. Asterisk forces signed char on all platforms via -fsigned-char (configure.ac lines 194-211). When a TLV parameter length byte is >= 0x80, it sign-extends to a negative integer. The bounds check if (res > 32) does not catch negative values. The negative res is then passed to memcpy where it is cast to size_t, producing a read of ~18 EB. Immediate SIGSEGV.
Vulnerable code (main/callerid.c lines 742-748, Name path):
res = cid->rawdata[x]; // 0x80 -> -128 (signed)
if (res > 32) { res = 32; } // -128 > 32 is false: bypassed
memcpy(cid->name, cid->rawdata + x + 1, res); // size_t(-128) = crash
Same pattern at lines 694-703 (Number path).
Trigger: Crafted MDMF Caller ID spill on analog line with parameter length byte >= 0x80. Requires physical access to analog copper pair connected to a DAHDI FXO port.
Not reachable via: SIP, PRI/BRI, DTMF-based CID, or SIP-to-PSTN gateways (gateway regenerates compliant MDMF).
Fix: Change char rawdata[256] to unsigned char rawdata[256] (PR #1838).