examples : sprintf -> snprintf (#8434)

* examples : sprintf -> snprintf

ggml-ci

* examples : use sizeof() instead of hardcoded constants
This commit is contained in:
Georgi Gerganov 2024-07-12 10:46:14 +03:00 committed by GitHub
parent 370b1f7e7a
commit 71c1121d11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -99,7 +99,7 @@ static bool ggml_debug(struct ggml_tensor * t, bool ask, void * user_data) {
char src1_str[128] = {0};
if (src1) {
sprintf(src1_str, "%s{%s}", src1->name, ggml_ne_string(src1).c_str());
snprintf(src1_str, sizeof(src1_str), "%s{%s}", src1->name, ggml_ne_string(src1).c_str());
}
printf("%s: %24s = (%s) %10s(%s{%s}, %s}) = {%s}\n", __func__,