ggml : fix strncpy warning

This commit is contained in:
Georgi Gerganov 2024-02-17 18:03:56 +02:00
parent c506e6a820
commit ffab4152aa
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

2
ggml.c
View file

@ -3220,7 +3220,7 @@ const char * ggml_get_name(const struct ggml_tensor * tensor) {
}
struct ggml_tensor * ggml_set_name(struct ggml_tensor * tensor, const char * name) {
strncpy(tensor->name, name, sizeof(tensor->name));
strncpy(tensor->name, name, sizeof(tensor->name) - 1);
tensor->name[sizeof(tensor->name) - 1] = '\0';
return tensor;
}