From be048aa26623610ef83979477b2afd9fe162d5c1 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Thu, 28 Dec 2023 00:04:22 +0300 Subject: [PATCH] reverse-ramdisk.c: correct `snprintf` call --- c-programming/reverse-ramdisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-programming/reverse-ramdisk.c b/c-programming/reverse-ramdisk.c index 825e7f1..f36e5ea 100644 --- a/c-programming/reverse-ramdisk.c +++ b/c-programming/reverse-ramdisk.c @@ -67,7 +67,7 @@ int tf_alloc(size_t n, size_t type_size) { line_fail(-2); return -1; } - int res = snprintf(file_path, file_path_len, "tf_%" PRIuMAX ".tmp", + int res = snprintf(file_path, file_path_len + 1, "tf_%" PRIuMAX ".tmp", (uintmax_t) num_temp_files); if ((size_t) res != file_path_len) { line_fail(-2);