allocating correct size in why2_chat_base64_encode
This commit is contained in:
parent
06d835e2b9
commit
e688023383
@ -116,7 +116,7 @@ char *why2_chat_base64_encode(char *message, size_t *length)
|
|||||||
BIO_get_mem_ptr(bio, &buffer_ptr);
|
BIO_get_mem_ptr(bio, &buffer_ptr);
|
||||||
|
|
||||||
//COPY
|
//COPY
|
||||||
encoded_message = why2_malloc(buffer_ptr -> length + why2_count_int_length((int) *length) + 2);
|
encoded_message = why2_malloc(buffer_ptr -> length + why2_count_int_length((int) *length) + 3);
|
||||||
memcpy(encoded_message, buffer_ptr -> data, buffer_ptr -> length);
|
memcpy(encoded_message, buffer_ptr -> data, buffer_ptr -> length);
|
||||||
|
|
||||||
sprintf(encoded_message + buffer_ptr -> length, "%c%zu%c", WHY2_CHAT_BASE64_LENGTH_DELIMITER, *length, '\0'); //APPEND LENGTH
|
sprintf(encoded_message + buffer_ptr -> length, "%c%zu%c", WHY2_CHAT_BASE64_LENGTH_DELIMITER, *length, '\0'); //APPEND LENGTH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user