Port: fix -Wdeprecated-declarations warning about sprintf on macOS clang 14
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 18 Apr 2023 19:02:37 +0000 (15:02 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 1 May 2023 17:58:27 +0000 (13:58 -0400)
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 <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/uuid.cpp

index 8aa42a4e6fc4b579d55f84d4bcceca43f70a4ef0..4c64c08acedafe03de2e3d32b168146b97271134 100644 (file)
@@ -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)
This page took 0.025186 seconds and 4 git commands to generate.