mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-11 22:52:47 +01:00
gpgparsemail: Die on parse error (not abort).
* tools/gpgparsemail.c (parse_message): Don't use ERRNO. * tools/rfc822parse.c (transition_to_body): Return -1. (transition_to_header, insert_header): Likewise. -- GnuPG-bug-id: 1977 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
9bf650db02
commit
c13e459ffe
@ -654,7 +654,7 @@ parse_message (FILE *fp)
|
|||||||
|
|
||||||
|
|
||||||
if (rfc822parse_insert (msg, line, length))
|
if (rfc822parse_insert (msg, line, length))
|
||||||
die ("parser failed: %s", strerror (errno));
|
die ("parser failed");
|
||||||
|
|
||||||
if (info.hashing)
|
if (info.hashing)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +420,9 @@ transition_to_body (rfc822parse_t msg)
|
|||||||
s = rfc822parse_query_parameter (ctx, "boundary", 0);
|
s = rfc822parse_query_parameter (ctx, "boundary", 0);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
assert (!msg->current_part->boundary);
|
if (msg->current_part->boundary)
|
||||||
|
return -1;
|
||||||
|
|
||||||
msg->current_part->boundary = malloc (strlen (s) + 1);
|
msg->current_part->boundary = malloc (strlen (s) + 1);
|
||||||
if (msg->current_part->boundary)
|
if (msg->current_part->boundary)
|
||||||
{
|
{
|
||||||
@ -437,7 +439,8 @@ transition_to_body (rfc822parse_t msg)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
rc = do_callback (msg, RFC822PARSE_LEVEL_DOWN);
|
rc = do_callback (msg, RFC822PARSE_LEVEL_DOWN);
|
||||||
assert (!msg->current_part->down);
|
if (msg->current_part->down)
|
||||||
|
return -1;
|
||||||
msg->current_part->down = part;
|
msg->current_part->down = part;
|
||||||
msg->current_part = part;
|
msg->current_part = part;
|
||||||
msg->in_preamble = 1;
|
msg->in_preamble = 1;
|
||||||
@ -458,8 +461,9 @@ transition_to_header (rfc822parse_t msg)
|
|||||||
{
|
{
|
||||||
part_t part;
|
part_t part;
|
||||||
|
|
||||||
assert (msg->current_part);
|
if (!(msg->current_part
|
||||||
assert (!msg->current_part->right);
|
&& !msg->current_part->right))
|
||||||
|
return -1;
|
||||||
|
|
||||||
part = new_part ();
|
part = new_part ();
|
||||||
if (!part)
|
if (!part)
|
||||||
@ -476,7 +480,9 @@ insert_header (rfc822parse_t msg, const unsigned char *line, size_t length)
|
|||||||
{
|
{
|
||||||
HDR_LINE hdr;
|
HDR_LINE hdr;
|
||||||
|
|
||||||
assert (msg->current_part);
|
if (!msg->current_part)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (!length)
|
if (!length)
|
||||||
{
|
{
|
||||||
msg->in_body = 1;
|
msg->in_body = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user