[hackers] [sbase] Fix segmentation fault in paste(1) || Pieter Kockx

From: <git_AT_suckless.org>
Date: Fri, 8 Sep 2017 08:07:48 +0200 (CEST)

commit d90ba15f2990d7dc06d7c0c7877079e1f8dd3464
Author: Pieter Kockx <pieterkockx_AT_gmail.com>
AuthorDate: Thu Sep 7 19:00:10 2017 +0200
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Thu Sep 7 22:58:24 2017 -0700

    Fix segmentation fault in paste(1)
    
    libutil/unescape received a pointer to a a string in
    read-only memory.

diff --git a/paste.c b/paste.c
index 1d4e9f6..b0ac761 100644
--- a/paste.c
+++ b/paste.c
_AT_@ -97,6 +97,7 @@ main(int argc, char *argv[])
                 break;
         case 'd':
                 adelim = EARGF(usage());
+ unescape(adelim);
                 break;
         default:
                 usage();
_AT_@ -107,7 +108,6 @@ main(int argc, char *argv[])
 
         /* populate delimiters */
         /* TODO: fix libutf to accept sizes */
- unescape(adelim);
         delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
         if (!(delimlen = utftorunestr(adelim, delim)))
                 usage();
Received on Fri Sep 08 2017 - 08:07:48 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 08 2017 - 08:12:22 CEST