NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/41159: paste(1) delimiter bug



>Number:         41159
>Category:       bin
>Synopsis:       paste(1) delimiter bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 06 14:05:00 +0000 2009
>Originator:     David A. Holland
>Release:        NetBSD 5.99.7 (20090222)
>Organization:
>Environment:
System: NetBSD tanaqui 5.99.7 NetBSD 5.99.7 (TANAQUI) #24: Mon Feb 9 11:19:51 
EST 2009 root@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:

        When given the -d '\0' option to use no delimiters, paste
        inserts a spurious '0' character at the beginning of each
        line.

>How-To-Repeat:
        
        paste -d '\0' file1.txt file2.txt

>Fix:

        It turns out to depend on the null-termination of the
        delimiter list string, but doesn't ensure the string remains
        null-terminated after evaluating escape sequences.

        I will commit this in due course; this PR is mostly to make
        sure I don't forget about it.

Index: paste.c
===================================================================
RCS file: /cvsroot/src/usr.bin/paste/paste.c,v
retrieving revision 1.14
diff -u -p -r1.14 paste.c
--- paste.c     21 Jul 2008 14:19:24 -0000      1.14
+++ paste.c     6 Apr 2009 13:58:53 -0000
@@ -221,6 +221,7 @@ tr(char *arg)
 
        if (!cnt)
                errx(1, "no delimiters specified.");
+       *arg = '\0';
        return(cnt);
 }
 



Home | Main Index | Thread Index | Old Index