Replace sprintf with snprintf in all of Trick source. #1384 (#1392)

* Replace sprintf with snprintf in all of Trick source. #1384

* Don't add -Werror for MacOS because of deprecated sprintf warnings which we cant get rid of because SWIG. #1384

* Fixed an unbalanced parenthesis in S_overrides.mk. #1384
This commit is contained in:
jmpenn
2022-11-15 15:00:05 -06:00
committed by GitHub
parent 265513684a
commit 2a03ff5cf4
72 changed files with 303 additions and 277 deletions

View File

@ -148,7 +148,7 @@ void TimeSession::sendMessage() {
int month = theTime->tm_mon + 1;
int year = theTime->tm_year + 1900;
sprintf(message, "Time: %02d:%02d:%02d Date: %02d/%02d/%d\n", hours, minutes, seconds, month, day, year);
snprintf(message, sizeof(message), "Time: %02d:%02d:%02d Date: %02d/%02d/%d\n", hours, minutes, seconds, month, day, year);
mg_websocket_write(connection, MG_WEBSOCKET_OPCODE_TEXT, message, strlen(message));
}
@ -270,4 +270,4 @@ To test your new web socket interface, put the following ```time.html``` file in
</html>
```
Continue to [Simulation Utilities](../simulation_utilities/Simulation-Utilities)
Continue to [Simulation Utilities](../simulation_utilities/Simulation-Utilities)