From 9b2433c2cd44834a61d15b81e70f8f9c541cd4f7 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Mon, 5 Feb 2024 17:33:38 +0100 Subject: [PATCH 1/2] Fix: check size of struct T_devices --- src/hwapi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hwapi.cpp b/src/hwapi.cpp index 5c10889..5884d58 100644 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -3326,6 +3326,10 @@ void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const //runProcess->epi_restore64BdevParameter(&LL, buf); // wozu die??? epi_restoreRbDeviceSettings(&LL, buf); // viel besser, stimmt immer + if (LL >= sizeof(T_devices)) { + LL = sizeof (T_devices); + } + // Puffer in struct eintragen: start = &deviceSettings->kindOfPrinter; nn=0; From 69d0420e7d70fdb52e6d4ad5353d68107e030f77 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Tue, 6 Feb 2024 09:36:26 +0100 Subject: [PATCH 2/2] sys_restoreDeviceParameter() check size of struct T_devices --- src/hwapi.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/hwapi.cpp b/src/hwapi.cpp index 5884d58..2c40bef 100644 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -3319,26 +3319,15 @@ void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const // attention: only applies if function "sys_sendDeviceParameter()" was used to send this settings before // cannot be used to see settings programmed by JsonFile uint8_t buf[64]; - uint8_t LL, nn; + uint8_t LL; tslib_strclr(buf,0,64); - uint8_t *start; //runProcess->epi_restore64BdevParameter(&LL, buf); // wozu die??? epi_restoreRbDeviceSettings(&LL, buf); // viel besser, stimmt immer - if (LL >= sizeof(T_devices)) { - LL = sizeof (T_devices); - } - - // Puffer in struct eintragen: - start = &deviceSettings->kindOfPrinter; - nn=0; - do - { - *start = buf[nn]; - start++; - } while(++nn