Skip to content
Snippets Groups Projects
Commit 02414ee3 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Actually do bounds checking on timeout.

Fix warning while we're here.
parent c00bd91b
No related branches found
No related tags found
No related merge requests found
...@@ -1592,9 +1592,15 @@ service_loop(int argc, char** argv) ...@@ -1592,9 +1592,15 @@ service_loop(int argc, char** argv)
comWriteString(com_handle, banner); comWriteString(com_handle, banner);
comWriteString(com_handle, "\r\n"); comWriteString(com_handle, "\r\n");
if(prompt[0] != '\0') { if(prompt[0] != '\0') {
int ptimeout = prompt_timeout * 1000; int ptimeout;
if (ptimeout == 0) if (prompt_timeout == 0)
ptimeout = COM_INFINITE_TIMEOUT; ptimeout = COM_INFINITE_TIMEOUT;
else {
if (prompt_timeout < INT_MAX / 1000)
ptimeout = prompt_timeout * 1000;
else
ptimeout = INT_MAX;
}
parse_tcp_section("TCP"); parse_tcp_section("TCP");
comWriteString(com_handle, prompt); comWriteString(com_handle, prompt);
char ch; char ch;
...@@ -1645,7 +1651,7 @@ int main(int argc, char** argv) ...@@ -1645,7 +1651,7 @@ int main(int argc, char** argv)
" Copyright %s Rob Swindell" " Copyright %s Rob Swindell"
,TITLE ,TITLE
,PLATFORM_DESC ,PLATFORM_DESC
,__DATE__+7 ,&__DATE__[7]
); );
fprintf(stdout,"%s\n\n", banner); fprintf(stdout,"%s\n\n", banner);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment