Commit Graph
1 Commits
Author SHA1 Message Date
Tobias KlausmannandDominic Radermacher c8ce56e054 libptouch: fix stack buffer overflow in ptouch_sendraster
The raster packet buffer was fixed at 64 bytes, but a full raster line is
max_px/8 bytes plus up to 4 header bytes. For printers with a printhead
wider than 480px this overflows the buffer and smashes the stack. No
previously supported printer was wide enough to trigger it (the widest,
PT-9200DX at 384px, needs 52 bytes), but a 560px printhead needs 74.

Size the buffer to 128 bytes, which is the maximum a single packet can be
since ptouch_send() caps transfers at 128 bytes.
2026-07-18 07:52:44 +02:00