mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Fixes for CVE-2006-6235
This commit is contained in:
parent
114b20e8be
commit
0173cd5a98
31 changed files with 542 additions and 337 deletions
51
g10/armor.c
51
g10/armor.c
|
@ -114,6 +114,54 @@ static char *tail_strings[] = {
|
|||
};
|
||||
|
||||
|
||||
static int armor_filter ( void *opaque, int control,
|
||||
iobuf_t chain, byte *buf, size_t *ret_len);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Create a new context for armor filters. */
|
||||
armor_filter_context_t *
|
||||
new_armor_context (void)
|
||||
{
|
||||
armor_filter_context_t *afx;
|
||||
|
||||
afx = xcalloc (1, sizeof *afx);
|
||||
afx->refcount = 1;
|
||||
|
||||
return afx;
|
||||
}
|
||||
|
||||
/* Release an armor filter context. Passing NULL is explicitly
|
||||
allowed and a no-op. */
|
||||
void
|
||||
release_armor_context (armor_filter_context_t *afx)
|
||||
{
|
||||
if (!afx)
|
||||
return;
|
||||
assert (afx->refcount);
|
||||
if ( --afx->refcount )
|
||||
return;
|
||||
xfree (afx);
|
||||
}
|
||||
|
||||
/* Push the armor filter onto the iobuf stream IOBUF. */
|
||||
int
|
||||
push_armor_filter (armor_filter_context_t *afx, iobuf_t iobuf)
|
||||
{
|
||||
int rc;
|
||||
|
||||
afx->refcount++;
|
||||
rc = iobuf_push_filter (iobuf, armor_filter, afx);
|
||||
if (rc)
|
||||
afx->refcount--;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
initialize(void)
|
||||
{
|
||||
|
@ -862,7 +910,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||
/****************
|
||||
* This filter is used to handle the armor stuff
|
||||
*/
|
||||
int
|
||||
static int
|
||||
armor_filter( void *opaque, int control,
|
||||
IOBUF a, byte *buf, size_t *ret_len)
|
||||
{
|
||||
|
@ -1168,6 +1216,7 @@ armor_filter( void *opaque, int control,
|
|||
"probably a buggy MTA has been used\n") );
|
||||
xfree( afx->buffer );
|
||||
afx->buffer = NULL;
|
||||
release_armor_context (afx);
|
||||
}
|
||||
else if( control == IOBUFCTRL_DESC )
|
||||
*(char**)buf = "armor_filter";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue