From 02414ee3190c36a449e1c4a1eafb52b3cf4976a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Mon, 24 Jan 2022 19:31:29 -0500
Subject: [PATCH] Actually do bounds checking on timeout.

Fix warning while we're here.
---
 src/sexpots/sexpots.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/sexpots/sexpots.c b/src/sexpots/sexpots.c
index 1d5a440619..f8c0e90485 100644
--- a/src/sexpots/sexpots.c
+++ b/src/sexpots/sexpots.c
@@ -1592,9 +1592,15 @@ service_loop(int argc, char** argv)
 		comWriteString(com_handle, banner);
 		comWriteString(com_handle, "\r\n");
 		if(prompt[0] != '\0') {
-			int ptimeout = prompt_timeout * 1000;
-			if (ptimeout == 0)
+			int ptimeout;
+			if (prompt_timeout == 0)
 				ptimeout = COM_INFINITE_TIMEOUT;
+			else {
+				if (prompt_timeout < INT_MAX / 1000)
+					ptimeout = prompt_timeout * 1000;
+				else
+					ptimeout = INT_MAX;
+			}
 			parse_tcp_section("TCP");
 			comWriteString(com_handle, prompt);
 			char ch;
@@ -1645,7 +1651,7 @@ int main(int argc, char** argv)
 		" Copyright %s Rob Swindell"
 		,TITLE
 		,PLATFORM_DESC
-		,__DATE__+7
+		,&__DATE__[7]
 		);
 
 	fprintf(stdout,"%s\n\n", banner);
-- 
GitLab