[Core] switch_ivr_set_user_xml: Buffer is wrongly truncated when it's small in get_prefixed_str()

This commit is contained in:
Andrey Volk 2021-03-10 16:10:54 +03:00
parent 2e65ca908d
commit effafb6993

View File

@ -3861,7 +3861,7 @@ static const char *get_prefixed_str(char *buffer, size_t buffer_size, const char
if (str_len + prefix_size + 1 > buffer_size) {
memcpy(buffer + prefix_size, str, buffer_size - prefix_size - 1);
buffer[buffer_size - prefix_size - 1] = '\0';
buffer[buffer_size - 1] = '\0';
} else {
memcpy(buffer + prefix_size, str, str_len + 1);
}