opencl : fix possible buffer overflow in dump_tensor (llama/14490)

This commit is contained in:
zhouwg
2025-07-12 19:23:56 +03:00
committed by Georgi Gerganov
parent cd87a2f7e0
commit 2e04b81f3e
+1 -1
View File
@@ -3199,7 +3199,7 @@ static void dump_tensor(ggml_backend_t backend, const struct ggml_tensor * tenso
// Open file and dump.
char fname[512];
sprintf(fname, "./tensor-dumps/%s.txt", tensor->name);
snprintf(fname, sizeof(fname), "./tensor-dumps/%s.txt", tensor->name);
FILE * f = fopen(fname, "w");
if (!f) {
printf("Failed to open %s\n", fname);