From 2d7bada6ecc247e508640b31fe31e323731dadc1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Oct 2026 23:19:06 +0200 Subject: [PATCH] qrcode: reserve extra spaces for NUL separators When allocing spaces to store the test, add extra spaces for NUL separators that could be inserted for each missing run in an incomplete Structured Append QR codes. Fixes #343. Signed-off-by: Mauro Carvalho Chehab --- zbar/qrcode/qrdectxt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zbar/qrcode/qrdectxt.c b/zbar/qrcode/qrdectxt.c index f6b133a3..3977dc00 100644 --- a/zbar/qrcode/qrdectxt.c +++ b/zbar/qrcode/qrdectxt.c @@ -204,6 +204,13 @@ int qr_code_data_list_extract_text(const qr_code_data_list *_qrlist, } } + /* + * Add extra spaces for NUL separators that could be inserted + * for each missing run in an incomplete structured-append group. + */ + if (sa_size > 1) + sa_ctext += sa_size - 1; + /*Step 2: Convert the entries.*/ sa_text = (char *)malloc((sa_ctext + 1) * sizeof(*sa_text)); sa_ntext = 0;