aboutsummaryrefslogtreecommitdiffstats
path: root/fastos/src/tests/threadtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fastos/src/tests/threadtest.cpp')
-rw-r--r--fastos/src/tests/threadtest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp
index 34723e4edce..563b41ac229 100644
--- a/fastos/src/tests/threadtest.cpp
+++ b/fastos/src/tests/threadtest.cpp
@@ -18,6 +18,7 @@ class ThreadTest : public ThreadTestBase
void TooManyThreadsTest ()
{
TestHeader("Too Many Threads Test");
+ static constexpr size_t message_size = 100;
FastOS_ThreadPool *pool = new FastOS_ThreadPool(MAX_THREADS);
@@ -27,11 +28,11 @@ class ThreadTest : public ThreadTestBase
for (i=0; i<MAX_THREADS+1; i++) {
jobs[i].code = WAIT_FOR_BREAK_FLAG;
- jobs[i].message = static_cast<char *>(malloc(100));
+ jobs[i].message = static_cast<char *>(malloc(message_size));
if (jobs[i].message == nullptr) {
abort(); // GCC may infer that a potentially null ptr is passed to sprintf
}
- sprintf(jobs[i].message, "Thread %d invocation", i+1);
+ snprintf(jobs[i].message, message_size, "Thread %d invocation", i+1);
}
for (i=0; i<MAX_THREADS+1; i++) {