From 92ab9157c79612d5c35495bfb6a6242896a9cee7 Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Sun, 30 Aug 2020 15:25:39 +0200
Subject: [PATCH] fix for bug 563289

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 core/Communication.cc        |  5 ++++-
 mctr2/mctr/MainController.cc | 12 +++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/core/Communication.cc b/core/Communication.cc
index 46a5602c1..e7e22e906 100644
--- a/core/Communication.cc
+++ b/core/Communication.cc
@@ -1235,7 +1235,10 @@ boolean TTCN_Communication::send_log(time_t timestamp_sec, long timestamp_usec,
   if (is_connected) {
     Text_Buf text_buf;
     text_buf.push_int(MSG_LOG);
-    text_buf.push_int(timestamp_sec);
+    int upper_int = timestamp_sec / 0xffffffff;
+    int lower_int = timestamp_sec % 0xffffffff;
+    text_buf.push_int(upper_int);
+    text_buf.push_int(lower_int);
     text_buf.push_int(timestamp_usec);
     text_buf.push_int(event_severity);
     text_buf.push_int(message_text_len);
diff --git a/mctr2/mctr/MainController.cc b/mctr2/mctr/MainController.cc
index c4e6ea841..14db39cf0 100644
--- a/mctr2/mctr/MainController.cc
+++ b/mctr2/mctr/MainController.cc
@@ -3717,7 +3717,9 @@ void MainController::process_log(unknown_connection *conn)
 {
   Text_Buf& text_buf = *conn->text_buf;
   struct timeval tv;
-  tv.tv_sec = text_buf.pull_int().get_val();
+  int upper_int = text_buf.pull_int().get_val();
+  int lower_int = text_buf.pull_int().get_val();
+  tv.tv_sec = upper_int * 0xffffffff + lower_int;
   tv.tv_usec = text_buf.pull_int().get_val();
   char *source = mprintf("<unknown>@%s", conn->ip_addr->get_host_str());
   int severity = text_buf.pull_int().get_val();
@@ -3912,7 +3914,9 @@ void MainController::process_log(host_struct *hc)
 {
   Text_Buf& text_buf = *hc->text_buf;
   struct timeval tv;
-  tv.tv_sec = text_buf.pull_int().get_val();
+  int upper_int = text_buf.pull_int().get_val();
+  int lower_int = text_buf.pull_int().get_val();
+  tv.tv_sec = upper_int * 0xffffffff + lower_int;
   tv.tv_usec = text_buf.pull_int().get_val();
   int severity = text_buf.pull_int().get_val();
   char *message = text_buf.pull_string();
@@ -4133,7 +4137,9 @@ void MainController::process_log(component_struct *tc)
 {
   Text_Buf& text_buf = *tc->text_buf;
   struct timeval tv;
-  tv.tv_sec = text_buf.pull_int().get_val();
+  int upper_int = text_buf.pull_int().get_val();
+  int lower_int = text_buf.pull_int().get_val();
+  tv.tv_sec = upper_int * 0xffffffff + lower_int;
   tv.tv_usec = text_buf.pull_int().get_val();
   int severity = text_buf.pull_int().get_val();
   char *message = text_buf.pull_string();
-- 
GitLab