Skip to content

Commit 307e79d

Browse files
authored
opencl : fix possible buffer overflow in dump_tensor (#14490)
1 parent d7f5f4e commit 307e79d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml-opencl/ggml-opencl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,7 @@ static void dump_tensor(ggml_backend_t backend, const struct ggml_tensor * tenso
31993199

32003200
// Open file and dump.
32013201
char fname[512];
3202-
sprintf(fname, "./tensor-dumps/%s.txt", tensor->name);
3202+
snprintf(fname, sizeof(fname), "./tensor-dumps/%s.txt", tensor->name);
32033203
FILE * f = fopen(fname, "w");
32043204
if (!f) {
32053205
printf("Failed to open %s\n", fname);

0 commit comments

Comments
 (0)