commit 121dfea858507a89683c16ed417e0ac185fd16a6
parent 66893572a7e7cd2421509f7ed9ebc396a73bd523
Author: wwp <subscript@free.fr>
Date: Sat, 11 Sep 2021 22:44:31 +0200
Fix CID 1491382: malloc size too short by one because, worst case, qp_decode_const
will dump the exact same input string.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vcard.c b/src/vcard.c
@@ -390,8 +390,8 @@ static gchar *vcard_unescape_qp( gchar *value ) {
return NULL;
len = strlen(value);
- res = g_malloc(len);
- qp_decode_const(res, len-1, value);
+ res = g_malloc(len + 1);
+ qp_decode_const(res, len, value);
if (!g_utf8_validate(res, -1, NULL)) {
gchar *mybuf = g_malloc(strlen(res)*2 +1);
conv_localetodisp(mybuf, strlen(res)*2 +1, res);