From 5932d187382dd644e6fa87bb6acb49afee8d33eb Mon Sep 17 00:00:00 2001 From: Rob Armstrong <roarmstrong@nvidia.com> Date: Tue, 11 Feb 2025 17:31:36 -0800 Subject: [PATCH] Fix warning about potential string overflow in 0_Introduction/simpleIPC --- Samples/0_Introduction/simpleIPC/simpleIPC.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples/0_Introduction/simpleIPC/simpleIPC.cu b/Samples/0_Introduction/simpleIPC/simpleIPC.cu index 711d1617..5261e509 100644 --- a/Samples/0_Introduction/simpleIPC/simpleIPC.cu +++ b/Samples/0_Introduction/simpleIPC/simpleIPC.cu @@ -281,11 +281,11 @@ static void parentProcess(char *app) { // Launch the child processes! for (i = 0; i < shm->nprocesses; i++) { - char devIdx[10]; + char devIdx[12]; // Increased size to ensure enough space for formatted integer char *const args[] = {app, devIdx, NULL}; Process process; - SPRINTF(devIdx, "%d", i); + snprintf(devIdx, sizeof(devIdx), "%d", i); if (spawnProcess(&process, app, args)) { printf("Failed to create process\n");