sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 6d2cbf7a3f52f5256ed5ec9669f35893bd6c21d1
parent ec02816d3edfbc4de55afca285eba3377cda2ab5
Author: Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com>
Date:   Tue, 10 Feb 2015 19:36:34 +0000

uudecode: fix flushing in corner case

Diffstat:
Muudecode.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/uudecode.c b/uudecode.c @@ -173,16 +173,16 @@ uudecodeb64(FILE *fp, FILE *outfp) if (++t < 4) continue; else - return; + goto flush; } else if (b == 1) { eprintf("unexpected \"=\" appeared."); } else if (b == 2) { *po++ = b24[0]; - fwrite(out, 1, (po - out), outfp); + goto flush; } else if (b == 3) { *po++ = b24[0]; *po++ = b24[1]; - fwrite(out, 1, (po - out), outfp); + goto flush; } } if ((e = b64dt[(int)*pb]) == -1) { @@ -205,9 +205,11 @@ uudecodeb64(FILE *fp, FILE *outfp) b = 0; } } - fwrite(out, 1, (po - out), outfp); + goto flush; } eprintf("invalid uudecode footer \"====\" not found\n"); +flush: + fwrite(out, 1, (po - out), outfp); } static void