From 3881ec0a37f9880d6e602a8205b0fb2bd4d54b4f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 30 Sep 2024 12:40:03 -0400 Subject: Replace sprintf with snprintf --- src/multiprocessing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multiprocessing.c b/src/multiprocessing.c index 039383e..5f5451e 100644 --- a/src/multiprocessing.c +++ b/src/multiprocessing.c @@ -292,7 +292,7 @@ int mp_pool_join(struct MultiProcessingPool *pool, size_t jobs, size_t flags) { char progress[1024] = {0}; if (pid > 0) { double percent = ((double) (tasks_complete + 1) / (double) pool->num_used) * 100; - sprintf(progress, "[%s:%s] [%3.1f%%]", pool->ident, slot->ident, percent); + snprintf(progress, sizeof(progress) - 1, "[%s:%s] [%3.1f%%]", pool->ident, slot->ident, percent); // The process ended in one the following ways // Note: SIGSTOP nor SIGCONT will not increment the tasks_complete counter -- cgit