1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* sign.c (sign_file): Do not push textmode filter onto an unopened IOBUF

(segfault).  Noted by Marcus Brinkmann.  Push and reinitialize textmode
filter for each file in a multiple file list.
This commit is contained in:
David Shaw 2003-02-13 02:26:45 +00:00
parent eee851ad83
commit 651b713d12
2 changed files with 17 additions and 2 deletions

View file

@ -619,7 +619,6 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
memset( &afx, 0, sizeof afx);
memset( &zfx, 0, sizeof zfx);
memset( &mfx, 0, sizeof mfx);
memset( &tfx, 0, sizeof tfx);
memset( &efx, 0, sizeof efx);
init_packet( &pkt );
@ -673,8 +672,12 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
goto leave;
/* prepare to calculate the MD over the input */
if( opt.textmode && !outfile )
if( opt.textmode && !outfile && !multifile )
{
memset( &tfx, 0, sizeof tfx);
iobuf_push_filter( inp, text_filter, &tfx );
}
mfx.md = md_open(0, 0);
/* If we're encrypting and signing, it is reasonable to pick the
@ -793,6 +796,11 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
}
if( opt.verbose )
fprintf(stderr, " `%s'", sl->d );
if(opt.textmode)
{
memset( &tfx, 0, sizeof tfx);
iobuf_push_filter( inp, text_filter, &tfx );
}
iobuf_push_filter( inp, md_filter, &mfx );
while( iobuf_get(inp) != -1 )
;