mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
ox: fix mistakes in p_ox_gpg_decrypt()
strcpy() can't work here because the data doesn't have to be NULL-terminated. So let's use memcpy. Fix memleak of plain_str.
This commit is contained in:
parent
281c8b7d8d
commit
e5e661e92d
@ -1195,11 +1195,13 @@ p_ox_gpg_decrypt(char* base64)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t len;
|
||||
char* plain_str = gpgme_data_release_and_get_mem(plain, &len);
|
||||
char* result = malloc(len + 1);
|
||||
strcpy(result, plain_str);
|
||||
memcpy(result, plain_str, len);
|
||||
result[len] = '\0';
|
||||
gpgme_free(plain_str);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user