From 575e9bfcff421bb50d369d15122fd03700533aa7 Mon Sep 17 00:00:00 2001 From: Aron Podrigal Date: Wed, 15 Jan 2025 16:51:28 -0600 Subject: [PATCH] Fix UUID generation error handling in switch_utils.c Ensure that invalid UUID generation scenarios are correctly handled by checking the return status of `switch_uuid_generate_version`. This prevents potential incorrect formatting or uninitialized usage. --- src/switch_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index f6f3ac4f60..4c48e0b0ed 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4116,8 +4116,9 @@ SWITCH_DECLARE(char *) switch_uuid_str_version(char *buf, switch_size_t len, int if (len < (SWITCH_UUID_FORMATTED_LENGTH + 1)) { switch_snprintf(buf, len, "INVALID"); + } else if (switch_uuid_generate_version(&uuid, version) != SWITCH_STATUS_SUCCESS) { + switch_snprintf(buf, len, "INVALID"); } else { - switch_uuid_generate_version(&uuid, version); switch_uuid_format(buf, &uuid); }