[hackers] [sbase] uudecode: fix no newline before EOF || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 20 Feb 2015 14:48:26 +0100 (CET)

commit 43ca2a5979f2c603e74845c6e947fc55dde84739
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri Feb 20 14:36:09 2015 +0100

    uudecode: fix no newline before EOF

diff --git a/uudecode.c b/uudecode.c
index 350dd5d..5412225 100644
--- a/uudecode.c
+++ b/uudecode.c
_AT_@ -170,10 +170,10 @@ uudecode(FILE *fp, FILE *outfp)
         while ((len = getline(&bufb, &n, fp)) != -1) {
                 p = bufb;
                 /* trim newlines */
- if (len && bufb[len - 1] != '\n')
- bufb[len - 1] = '\0';
- else
+ if (!len || bufb[len - 1] != '\n')
                         eprintf("no newline found, aborting\n");
+ bufb[len - 1] = '\0';
+
                 /* check for last line */
                 if ((i = DEC(*p)) <= 0)
                         break;
Received on Fri Feb 20 2015 - 14:48:26 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 20 2015 - 15:00:12 CET