summaryrefslogtreecommitdiff
path: root/mailinfo.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-04-21 00:45:40 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-04-21 00:45:40 -0700
commit3c144afe50b58875a41ea56ef118f41be7bf605a (patch)
tree7d68b348862205a33f72d57fb7719f6dfa16920e /mailinfo.c
parentMerge branch 'fix' (diff)
parentfix pack-object buffer size (diff)
downloadtgif-3c144afe50b58875a41ea56ef118f41be7bf605a.tar.xz
Merge branch 'fix'
* fix: fix pack-object buffer size mailinfo: decode underscore used in "Q" encoding properly. Reintroduce svn pools to solve the memory leak. pack-objects: do not stop at object that is "too small"
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mailinfo.c b/mailinfo.c
index 3c56f8c108..b27651935d 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -405,7 +405,7 @@ static unsigned hexval(int c)
return ~0;
}
-static int decode_q_segment(char *in, char *ot, char *ep)
+static int decode_q_segment(char *in, char *ot, char *ep, int rfc2047)
{
int c;
while ((c = *in++) != 0 && (in <= ep)) {
@@ -414,9 +414,11 @@ static int decode_q_segment(char *in, char *ot, char *ep)
if (d == '\n' || !d)
break; /* drop trailing newline */
*ot++ = ((hexval(d) << 4) | hexval(*in++));
+ continue;
}
- else
- *ot++ = c;
+ if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */
+ c = 0x20;
+ *ot++ = c;
}
*ot = 0;
return 0;
@@ -547,7 +549,7 @@ static void decode_header_bq(char *it)
sz = decode_b_segment(cp + 3, piecebuf, ep);
break;
case 'q':
- sz = decode_q_segment(cp + 3, piecebuf, ep);
+ sz = decode_q_segment(cp + 3, piecebuf, ep, 1);
break;
}
if (sz < 0)
@@ -569,7 +571,7 @@ static void decode_transfer_encoding(char *line)
switch (transfer_encoding) {
case TE_QP:
ep = line + strlen(line);
- decode_q_segment(line, line, ep);
+ decode_q_segment(line, line, ep, 0);
break;
case TE_BASE64:
ep = line + strlen(line);