[hackers] [sbase] uudecode: fix flushing in corner case || Tai Chi Minh Ralph Eastwood

From: <git_AT_suckless.org>
Date: Fri, 13 Feb 2015 12:22:59 +0100 (CET)

commit 4e864c54890a1426716073f1a6e848cd0fff64c8
Author: Tai Chi Minh Ralph Eastwood <tcmreastwood_AT_gmail.com>
Date: Tue Feb 10 19:36:34 2015 +0000

    uudecode: fix flushing in corner case

diff --git a/uudecode.c b/uudecode.c
index f3bbfd0..947a846 100644
--- a/uudecode.c
+++ b/uudecode.c
_AT_@ -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) {
_AT_@ -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
Received on Fri Feb 13 2015 - 12:22:59 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 13 2015 - 12:24:14 CET