From: Michael Jeanson Date: Tue, 18 Apr 2023 19:02:37 +0000 (-0400) Subject: Port: fix -Wdeprecated-declarations warning about sprintf on macOS clang 14 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=99afe3e2063edf476d5c46c261cf02e504d3a3c5;p=lttng-tools.git Port: fix -Wdeprecated-declarations warning about sprintf on macOS clang 14 Remove uses of sprintf to fix this warning: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] Change-Id: Idf3109f2eacafe0a7d18f4c132613f2f85afa09b Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/uuid.cpp b/src/common/uuid.cpp index 8aa42a4e6..4c64c08ac 100644 --- a/src/common/uuid.cpp +++ b/src/common/uuid.cpp @@ -27,7 +27,7 @@ bool lttng_uuid_is_init; void lttng_uuid_to_str(const lttng_uuid& uuid, char *uuid_str) { - sprintf(uuid_str, LTTNG_UUID_FMT, LTTNG_UUID_FMT_VALUES(uuid)); + snprintf(uuid_str, LTTNG_UUID_STR_LEN, LTTNG_UUID_FMT, LTTNG_UUID_FMT_VALUES(uuid)); } std::string lttng::utils::uuid_to_str(const lttng_uuid& uuid)