[hackers] [sbase] paste: fix crash with empty delimiter || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 1 Apr 2015 12:11:10 +0200 (CEST)

commit 398598dbbe5e533ca10d93c690becaa66f589b75
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon Mar 30 21:25:23 2015 +0200

    paste: fix crash with empty delimiter
    
    reproduce:
            paste -d '' /dev/null
    or
            paste -d '\0' /dev/null
    
    show usage() in these cases.

diff --git a/paste.c b/paste.c
index f90f37f..5ccda3a 100644
--- a/paste.c
+++ b/paste.c
_AT_@ -109,6 +109,8 @@ main(int argc, char *argv[])
         unescape(adelim);
         delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
         len = utftorunestr(adelim, delim);
+ if (!len)
+ usage();
 
         /* populate file list */
         dsc = ereallocarray(NULL, argc, sizeof(*dsc));
Received on Wed Apr 01 2015 - 12:11:10 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 01 2015 - 12:12:17 CEST