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
2025-12-15 07:15:10 +01:00
2015-12-29 14:11:00 +01:00
2026-03-08 09:28:09 +01:00

About:

ptouch-print is a command line tool to print labels on Brother P-Touch
printers on Linux.

There is no need to install the printer via CUPS, the printer is accessed
directly via libusb.

The tool was written for and tested with the PT-2430PC, but meanwhile is also
used with others (see "ptouch-print --list-supported")
Maybe others work too (please report USB VID and PID so I can include support
for further models, too).

Further info can be found at:
https://dominic.familie-radermacher.ch/projekte/ptouch-print/

Compile instructions:

./compile.sh

Note:

Dear visitor, currently I have absolutely no time for improvements on this
project (my free time currently is about one or two hours PER MONTH).
Therefore, I can not look at suggestions about improvements.
S
Description
No description provided
Readme
747 KiB
Languages
C 76.3%
CMake 18%
Roff 5.6%