Blob Blame History Raw
From 581bb46db5c3e7bc4abd1ea45487652756ce022f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kov=C3=A1cs=2C=20Gerg=C5=91=20Ferenc?= <kovgeri01@gmail.com>
Date: Mon, 5 Feb 2024 22:59:44 +0100
Subject: [PATCH 1/2] secure-logging: Fix printing of guint64 by using it's
 format macro.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kovács, Gergő Ferenc <kovgeri01@gmail.com>
---
 modules/secure-logging/slogkey/slogkey.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/secure-logging/slogkey/slogkey.c b/modules/secure-logging/slogkey/slogkey.c
index 13c5786943..685205cd07 100644
--- a/modules/secure-logging/slogkey/slogkey.c
+++ b/modules/secure-logging/slogkey/slogkey.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2024 Gergo Ferenc Kovacs
  * Copyright (c) 2019 Airbus Commercial Aircraft
  *
  * This library is free software; you can redistribute it and/or
@@ -157,7 +158,7 @@ int main(int argc, char **argv)
           msg_error("[SLOG] ERROR: Unable to read key file", evt_tag_str("file", keyfile));
           return ret;
         }
-      printf("counter=%zu\n", counterValue);
+      printf("counter=%" G_GUINT64_FORMAT "\n", counterValue);
     }
   else if (host)
     {

From ac13999810bced8f623b0e027579a95f23dc0641 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kov=C3=A1cs=2C=20Gerg=C5=91=20Ferenc?= <kovgeri01@gmail.com>
Date: Mon, 5 Feb 2024 23:01:08 +0100
Subject: [PATCH 2/2] secure-logging: Changed local variable type as
 g_io_channel_write_chars as it's 4th parameter accepts gsize.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kovács, Gergő Ferenc <kovgeri01@gmail.com>
---
 modules/secure-logging/slog.c                      | 3 ++-
 modules/secure-logging/tests/test_secure_logging.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/secure-logging/slog.c b/modules/secure-logging/slog.c
index 7bc8fcf7d4..4f585fe599 100644
--- a/modules/secure-logging/slog.c
+++ b/modules/secure-logging/slog.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2024 Gergo Ferenc Kovacs
  * Copyright (c) 2019 Airbus Commercial Aircraft
  *
  * This library is free software; you can redistribute it and/or
@@ -932,7 +933,7 @@ int writeKey(char *key, guint64 counter, gchar *keypath)
       return 0;
     }
 
-  guint64 outlen = 0;
+  gsize outlen = 0;
   // Write key
   status = g_io_channel_write_chars(keyfile, key, KEY_LENGTH, &outlen, &error);
   if(status != G_IO_STATUS_NORMAL)
diff --git a/modules/secure-logging/tests/test_secure_logging.c b/modules/secure-logging/tests/test_secure_logging.c
index 0f11d52e6d..0005b48652 100644
--- a/modules/secure-logging/tests/test_secure_logging.c
+++ b/modules/secure-logging/tests/test_secure_logging.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2024 Gergo Ferenc Kovacs
  * Copyright (c) 2019 Airbus Commercial Aircraft
  *
  * This library is free software; you can redistribute it and/or
@@ -373,7 +374,7 @@ void corruptKey(TestData *testData)
 
   cr_assert(status == G_IO_STATUS_NORMAL, " Unable to set encoding for key file %s", testData->keyFile->str);
 
-  guint64 outlen = 0;
+  gsize outlen = 0;
 
   int buflen = KEY_LENGTH + CMAC_LENGTH + sizeof(guint64);