1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 15:33:03 +01:00

Do exact length check for string passed to tox_pk_string_to_bytes

This commit is contained in:
jfreegman 2021-12-11 17:13:30 -05:00
parent 3030cda47e
commit 1cace1e81d
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -148,7 +148,7 @@ void get_elapsed_time_str(char *buf, int bufsize, time_t secs)
*/ */
int tox_pk_string_to_bytes(const char *hex_string, size_t hex_len, char *output, size_t output_size) int tox_pk_string_to_bytes(const char *hex_string, size_t hex_len, char *output, size_t output_size)
{ {
if (output_size != TOX_PUBLIC_KEY_SIZE || hex_len > output_size * 2) { if (output_size != TOX_PUBLIC_KEY_SIZE || hex_len != output_size * 2) {
return -1; return -1;
} }