From a5e9551564ac41727a54b76e250921be6d8fe282 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 23:34:05 +0100 Subject: [PATCH] Fix Set a limit size on value for barcode generation --- htdocs/barcode/printsheet.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 373effecbe8..f87196a93af 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -116,6 +116,11 @@ if ($action == 'builddoc') { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors'); $error++; } + $MAXLENGTH = 51200; // Limit set to 50Ko + if (dol_strlen($forbarcode) > $MAXLENGTH) { // barcode value + setEventMessages($langs->trans("ErrorFieldTooLong", $langs->transnoentitiesnoconv("BarcodeValue")).' ('.$langs->trans("RequireXStringMax", $MAXLENGTH).')', null, 'errors'); + $error++; + } if (empty($fk_barcode_type)) { // barcode type = barcode encoding setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors'); $error++;