diff --git a/g10/ChangeLog b/g10/ChangeLog index 00cacbfab..d0b926468 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2003-02-12 David Shaw + + * 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. + 2003-02-11 David Shaw * g10.c (print_mds): Check that SHA384 and 512 are available diff --git a/g10/sign.c b/g10/sign.c index a5f9f91cb..1cf4b59d2 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -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 ) ;