mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgsm: cleanup on error paths
* sm/minip12.c (p12_parse): set err on the different error paths -- GnuPG-bug-id: 6973 Fixes-commit: 101433dfb42b333e48427baf9dd58ac4787c9786 Signed-off-by: Ángel González <angel@pgp.16bits.net>
This commit is contained in:
parent
40b85d8e8c
commit
375c3a238a
45
sm/minip12.c
45
sm/minip12.c
@ -1945,43 +1945,46 @@ p12_parse (const unsigned char *buffer, size_t length, const char *pw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
where = "pfx";
|
where = "pfx";
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_sequence (tlv))
|
if ((err = tlv_expect_sequence (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
where = "pfxVersion";
|
where = "pfxVersion";
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_integer (tlv, &intval) || intval != 3)
|
if ((err = tlv_expect_integer (tlv, &intval)) || intval != 3)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
where = "authSave";
|
where = "authSave";
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_sequence (tlv))
|
if ((err = tlv_expect_sequence (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_object_id (tlv, &oid, &oidlen))
|
if ((err = tlv_expect_object_id (tlv, &oid, &oidlen)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (oidlen != DIM(oid_data) || memcmp (oid, oid_data, DIM(oid_data)))
|
if (oidlen != DIM(oid_data) || memcmp (oid, oid_data, DIM(oid_data)))
|
||||||
|
{
|
||||||
|
err = gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
goto bailout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = tlv_next (tlv)))
|
||||||
|
goto bailout;
|
||||||
|
if ((err = tlv_expect_context_tag (tlv, &intval)) || intval != 0 )
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_context_tag (tlv, &intval) || intval != 0 )
|
if ((err = tlv_expect_octet_string (tlv, 1, NULL, NULL)))
|
||||||
goto bailout;
|
|
||||||
|
|
||||||
if (tlv_next (tlv))
|
|
||||||
goto bailout;
|
|
||||||
if (tlv_expect_octet_string (tlv, 1, NULL, NULL))
|
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
if (tlv_peek (tlv, CLASS_UNIVERSAL, TAG_OCTET_STRING))
|
if (tlv_peek (tlv, CLASS_UNIVERSAL, TAG_OCTET_STRING))
|
||||||
{
|
{
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
err = tlv_expect_octet_string (tlv, 1, NULL, NULL);
|
err = tlv_expect_octet_string (tlv, 1, NULL, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
@ -1989,9 +1992,9 @@ p12_parse (const unsigned char *buffer, size_t length, const char *pw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
where = "bags";
|
where = "bags";
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_sequence (tlv))
|
if ((err = tlv_expect_sequence (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
startlevel = tlv_parser_level (tlv);
|
startlevel = tlv_parser_level (tlv);
|
||||||
@ -2000,12 +2003,12 @@ p12_parse (const unsigned char *buffer, size_t length, const char *pw,
|
|||||||
{
|
{
|
||||||
where = "bag-sequence";
|
where = "bag-sequence";
|
||||||
tlv_parser_dump_state (where, NULL, tlv);
|
tlv_parser_dump_state (where, NULL, tlv);
|
||||||
if (tlv_expect_sequence (tlv))
|
if ((err = tlv_expect_sequence (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
if (tlv_next (tlv))
|
if ((err = tlv_next (tlv)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
if (tlv_expect_object_id (tlv, &oid, &oidlen))
|
if ((err = tlv_expect_object_id (tlv, &oid, &oidlen)))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
if (oidlen == DIM(oid_encryptedData)
|
if (oidlen == DIM(oid_encryptedData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user