mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgparsemail: Fix case of zero length continuation lines.
* tools/rfc822parse.c (parse_field): Loop after continuation line. -- Using header lines like Name:[lf] [space][lf] [lf] resulted in running into the "(s2 = strchr (delimiters2, *s)" branch and inserting a new token for the empty continuation line. This also led to one byte read after the string which is what Hanno figured. The new code should handle empty continuation lines correct. Reported-by: Hanno Böck Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
6619ead2cf
commit
3fbeba64a8
@ -808,10 +808,12 @@ parse_field (HDR_LINE hdr)
|
|||||||
s++; /* Move over the colon. */
|
s++; /* Move over the colon. */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!*s)
|
while (!*s)
|
||||||
{
|
{
|
||||||
if (!hdr->next || !hdr->next->cont)
|
if (!hdr->next || !hdr->next->cont)
|
||||||
break;
|
return tok; /* Ready. */
|
||||||
|
|
||||||
|
/* Next item is a header continuation line. */
|
||||||
hdr = hdr->next;
|
hdr = hdr->next;
|
||||||
s = hdr->line;
|
s = hdr->line;
|
||||||
}
|
}
|
||||||
@ -824,10 +826,11 @@ parse_field (HDR_LINE hdr)
|
|||||||
invalid = 0;
|
invalid = 0;
|
||||||
for (s++;; s++)
|
for (s++;; s++)
|
||||||
{
|
{
|
||||||
if (!*s)
|
while (!*s)
|
||||||
{
|
{
|
||||||
if (!hdr->next || !hdr->next->cont)
|
if (!hdr->next || !hdr->next->cont)
|
||||||
break;
|
break;
|
||||||
|
/* Next item is a header continuation line. */
|
||||||
hdr = hdr->next;
|
hdr = hdr->next;
|
||||||
s = hdr->line;
|
s = hdr->line;
|
||||||
}
|
}
|
||||||
@ -880,6 +883,7 @@ parse_field (HDR_LINE hdr)
|
|||||||
|
|
||||||
if (*s2 || !hdr->next || !hdr->next->cont)
|
if (*s2 || !hdr->next || !hdr->next->cont)
|
||||||
break;
|
break;
|
||||||
|
/* Next item is a header continuation line. */
|
||||||
hdr = hdr->next;
|
hdr = hdr->next;
|
||||||
s = hdr->line;
|
s = hdr->line;
|
||||||
}
|
}
|
||||||
@ -931,8 +935,7 @@ parse_field (HDR_LINE hdr)
|
|||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*NOTREACHED*/
|
||||||
return tok;
|
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user