From 6c60f795c67ea67eeea7bee57da4fa218ed95792 Mon Sep 17 00:00:00 2001 From: Bojan Smojver Date: Mon, 31 Aug 2020 19:24:54 +1000 Subject: [PATCH] Add patch for snprintf() truncation in logging. --- xrdp-0.9.14-log-snprintf.patch | 17 +++++++++++++++++ xrdp.spec | 1 + 2 files changed, 18 insertions(+) create mode 100644 xrdp-0.9.14-log-snprintf.patch diff --git a/xrdp-0.9.14-log-snprintf.patch b/xrdp-0.9.14-log-snprintf.patch new file mode 100644 index 0000000..5b57019 --- /dev/null +++ b/xrdp-0.9.14-log-snprintf.patch @@ -0,0 +1,17 @@ +diff -ruN xrdp-0.9.14-v/common/log.c xrdp-0.9.14/common/log.c +--- xrdp-0.9.14-v/common/log.c 2020-08-26 12:32:21.000000000 +1000 ++++ xrdp-0.9.14/common/log.c 2020-08-31 19:23:06.347581743 +1000 +@@ -555,9 +555,10 @@ + now_t = time(&now_t); + now = localtime(&now_t); + +- snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", now->tm_year + 1900, +- now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, +- now->tm_sec); ++ snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", ++ (now->tm_year + 1900) % 10000, ++ (now->tm_mon + 1) % 100, now->tm_mday % 100, now->tm_hour % 100, ++ now->tm_min % 100, now->tm_sec % 100); + + internal_log_lvl2str(lvl, buff + 20); + diff --git a/xrdp.spec b/xrdp.spec index e0d2f95..95b1339 100644 --- a/xrdp.spec +++ b/xrdp.spec @@ -30,6 +30,7 @@ Patch2: xrdp-0.9.4-service.patch Patch3: xrdp-0.9.2-setpriv.patch Patch4: xrdp-0.9.10-scripts-libexec.patch Patch5: xrdp-0.9.6-script-interpreter.patch +Patch6: xrdp-0.9.14-log-snprintf.patch BuildRequires: gcc BuildRequires: libX11-devel