diff --git a/qemu-nbd.c b/qemu-nbd.c index 91ea01414d..6707ea5cac 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -353,7 +353,8 @@ int main(int argc, char **argv) } if (socket == NULL) { - sprintf(sockpath, SOCKET_PATH, basename(device)); + snprintf(sockpath, sizeof(sockpath), SOCKET_PATH, + basename(device)); socket = sockpath; }