From e3e52c8f9ab176f65b147d20d58bb7940bd2356a Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Sat, 24 Oct 2020 12:21:34 -0300 Subject: [PATCH] Fixing code scanning alerts. --- src/core/charset/view.c | 6 +++++- src/core/rpq.c | 5 ++++- src/core/util.c | 10 +++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/core/charset/view.c b/src/core/charset/view.c index bf7e3d2..5fe6838 100644 --- a/src/core/charset/view.c +++ b/src/core/charset/view.c @@ -58,7 +58,11 @@ LIB3270_EXPORT int lib3270_charsettable(H3270 *hSession) trace("%s","Showing charset table"); - (void) memset((char *) hSession->ea_buf, 0, hSession->view.rows * hSession->view.cols * sizeof(struct lib3270_ea)); + (void) memset( + (char *) hSession->ea_buf, + 0, + ((size_t) hSession->view.rows) * ((size_t) hSession->view.cols) * sizeof(struct lib3270_ea) + ); baddr = margin_left+hSession->max.cols; s = (hSession->max.cols * 0x11); diff --git a/src/core/rpq.c b/src/core/rpq.c index 1cb594d..2a6fe6c 100644 --- a/src/core/rpq.c +++ b/src/core/rpq.c @@ -438,7 +438,10 @@ static int get_rpq_timezone(H3270 *hSession) rpq_warning(hSession, _("RPQ: Unable to determine workstation local time")); return 1; } - memcpy(&here_tm, localtime(&here), sizeof(struct tm)); + + +// memcpy(&here_tm, localtime(&here), sizeof(struct tm)); + localtime_r(&here, &here_tm); if ((utc_tm = gmtime(&here)) == NULL) { diff --git a/src/core/util.c b/src/core/util.c index 44c91e4..c5a3d7a 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -264,7 +264,15 @@ void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...) lib3270_write_log(hSession, "3270", "Error Popup:\n%s\nrc=%d (%s)",text,errn,strerror(errn)); - lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, _( "Error" ), text, "%s (rc=%d)", errn, strerror(errn)); + lib3270_popup_dialog( + hSession, + LIB3270_NOTIFY_ERROR, + _( "Error" ), + text, + "%s (rc=%d)", + strerror(errn), + errn + ); lib3270_free(text); -- libgit2 0.21.2