Use snprintf().
authorCarl Hetherington <cth@carlh.net>
Thu, 28 Nov 2024 18:24:11 +0000 (19:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 29 Nov 2024 22:32:32 +0000 (23:32 +0100)
src/lib/grok/messenger.h

index e43e58858939fbdec33ce2ffe45764bcab330a5a..89205d0a8fd2934645d4dad43125ea3f5fa4fa82 100644 (file)
@@ -557,7 +557,7 @@ struct Messenger
                startThreads();
                auto fullServer = server + ":" + std::to_string(port);
                char cmd[4096];
-               sprintf(cmd,
+               snprintf(cmd, sizeof(cmd),
                                "./grk_compress -batch_src %s,%d,%d,%d,%d,%d -out_fmt j2k -k 1 "
                                "-G %d -%s %d,%d -j %s -J %s -v",
                                GRK_MSGR_BATCH_IMAGE.c_str(), width, stride, height, samplesPerPixel, depth,