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
|
@ -42,12 +42,12 @@
|
|||
int
|
||||
dearmor_file( const char *fname )
|
||||
{
|
||||
armor_filter_context_t afx;
|
||||
armor_filter_context_t *afx;
|
||||
IOBUF inp = NULL, out = NULL;
|
||||
int rc = 0;
|
||||
int c;
|
||||
|
||||
memset( &afx, 0, sizeof afx);
|
||||
afx = new_armor_context ();
|
||||
|
||||
/* prepare iobufs */
|
||||
inp = iobuf_open(fname);
|
||||
|
@ -64,23 +64,21 @@ dearmor_file( const char *fname )
|
|||
goto leave;
|
||||
}
|
||||
|
||||
iobuf_push_filter( inp, armor_filter, &afx );
|
||||
push_armor_filter ( afx, inp );
|
||||
|
||||
if( (rc = open_outfile( fname, 0, &out )) )
|
||||
goto leave;
|
||||
|
||||
|
||||
|
||||
while( (c = iobuf_get(inp)) != -1 )
|
||||
iobuf_put( out, c );
|
||||
|
||||
|
||||
leave:
|
||||
if( rc )
|
||||
iobuf_cancel(out);
|
||||
else
|
||||
iobuf_close(out);
|
||||
iobuf_close(inp);
|
||||
release_armor_context (afx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -91,12 +89,12 @@ dearmor_file( const char *fname )
|
|||
int
|
||||
enarmor_file( const char *fname )
|
||||
{
|
||||
armor_filter_context_t afx;
|
||||
armor_filter_context_t *afx;
|
||||
IOBUF inp = NULL, out = NULL;
|
||||
int rc = 0;
|
||||
int c;
|
||||
|
||||
memset( &afx, 0, sizeof afx);
|
||||
afx = new_armor_context ();
|
||||
|
||||
/* prepare iobufs */
|
||||
inp = iobuf_open(fname);
|
||||
|
@ -117,9 +115,9 @@ enarmor_file( const char *fname )
|
|||
if( (rc = open_outfile( fname, 1, &out )) )
|
||||
goto leave;
|
||||
|
||||
afx.what = 4;
|
||||
afx.hdrlines = "Comment: Use \"gpg --dearmor\" for unpacking\n";
|
||||
iobuf_push_filter( out, armor_filter, &afx );
|
||||
afx->what = 4;
|
||||
afx->hdrlines = "Comment: Use \"gpg --dearmor\" for unpacking\n";
|
||||
push_armor_filter ( afx, out );
|
||||
|
||||
while( (c = iobuf_get(inp)) != -1 )
|
||||
iobuf_put( out, c );
|
||||
|
@ -131,6 +129,7 @@ enarmor_file( const char *fname )
|
|||
else
|
||||
iobuf_close(out);
|
||||
iobuf_close(inp);
|
||||
release_armor_context (afx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue