Skip to content

Commit 575e9bf

Browse files
committed
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.
1 parent 323e907 commit 575e9bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/switch_utils.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4116,8 +4116,9 @@ SWITCH_DECLARE(char *) switch_uuid_str_version(char *buf, switch_size_t len, int
41164116

41174117
if (len < (SWITCH_UUID_FORMATTED_LENGTH + 1)) {
41184118
switch_snprintf(buf, len, "INVALID");
4119+
} else if (switch_uuid_generate_version(&uuid, version) != SWITCH_STATUS_SUCCESS) {
4120+
switch_snprintf(buf, len, "INVALID");
41194121
} else {
4120-
switch_uuid_generate_version(&uuid, version);
41214122
switch_uuid_format(buf, &uuid);
41224123
}
41234124

0 commit comments

Comments
 (0)