paste -d\\: avoid heap overrun for backslash at end of delim list
authorJim Meyering <meyering@redhat.com>
Thu, 27 Mar 2008 11:18:25 +0000 (12:18 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 27 Mar 2008 12:32:38 +0000 (13:32 +0100)
commitb58a8b4ef588ec8a365b920d12e27fdd71aa48d1
tree319fa5c7f3b3636f953271dca93f9a9b29c0b124
parent6743f8113658189cdc3d169616569e733403ee54
paste -d\\: avoid heap overrun for backslash at end of delim list

* src/paste.c: Include "quotearg.h".
(collapse_escapes): Handle backslash-escaped backslash explicitly.
Handle unescaped backslash at end of string by returning nonzero,
rather than by overrunning memory.
(main): Diagnose an invalid delimiter list -- carefully.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/misc/paste-no-nl (delim-bs): Add a test to demonstrate the
heap-smashing capability.
(delim-bs2): Prior to coreutils-5.1.2, this bug was a little harder
to demonstrate: it would corrupt a first-argument containing e.g., \b
* NEWS: Mention the bug fix.
* tests/misc/Makefile.am (TESTS): Reflect renaming.
* tests/misc/paste: Rename from paste-no-nl.

Signed-off-by: Jim Meyering <meyering@redhat.com>
NEWS
src/paste.c
tests/misc/Makefile.am
tests/misc/paste [moved from tests/misc/paste-no-nl with 64% similarity]