commit 82bd80a3403ef1c7603d3d0148ac371d2c285852
parent ac7ee135c7babde03957ed7da0ee24705173df3d
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);