* column --separator segfaults (patch attached)
@ 2012-08-14 9:57 B Watson
2012-08-14 16:30 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: B Watson @ 2012-08-14 9:57 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
Apologies to list moderator, I attempted to subscribe to the list but
vger's majordomo doesn't seem to like gmail. Anyway:
The --separator and --columns long options in util-linux-2.21.2 and in
a git clone from 5 minutes ago, don't work:
# Short options OK:
$ echo foobar | column -s x
foobar
$ echo foobar | column -c 10
foobar
# Long options bad:
$ echo foobar | column --separator=x
column: option '--separator' doesn't allow an argument
$ echo foobar | column --separator x
Segmentation fault
$ echo foobar | column --columns 10
column: bad columns width value: '(null)': Invalid argument
$ echo foobar | column --columns=10
column: option '--columns' doesn't allow an argument
Looks like a simple case of missing has_arg flag in the "struct option"
initialization for these two options. The patch just adds the flag. I
haven't done thorough testing of the patched code, but it seems to work
OK and it no longer segfaults or tries to dereference a null pointer.
[-- Attachment #2: column-fix_long_opts.diff --]
[-- Type: application/octet-stream, Size: 548 bytes --]
diff -Naur util-linux-2.21.2/text-utils/column.c util-linux-2.21.2.patched//text-utils/column.c
--- util-linux-2.21.2/text-utils/column.c 2012-05-25 05:44:59.000000000 -0400
+++ util-linux-2.21.2.patched//text-utils/column.c 2012-08-14 05:22:17.000000000 -0400
@@ -121,9 +121,9 @@
{
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
- { "columns", 0, 0, 'c' },
+ { "columns", 1, 0, 'c' },
{ "table", 0, 0, 't' },
- { "separator", 0, 0, 's' },
+ { "separator", 1, 0, 's' },
{ "fillrows", 0, 0, 'x' },
{ NULL, 0, 0, 0 },
};
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: column --separator segfaults (patch attached)
2012-08-14 9:57 column --separator segfaults (patch attached) B Watson
@ 2012-08-14 16:30 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-08-14 16:30 UTC (permalink / raw)
To: B Watson; +Cc: util-linux
On Tue, Aug 14, 2012 at 05:57:01AM -0400, B Watson wrote:
> The --separator and --columns long options in util-linux-2.21.2 and in
> a git clone from 5 minutes ago, don't work:
>
> # Short options OK:
>
> $ echo foobar | column -s x
> foobar
>
> $ echo foobar | column -c 10
> foobar
>
> # Long options bad:
>
> $ echo foobar | column --separator=x
> column: option '--separator' doesn't allow an argument
>
> $ echo foobar | column --separator x
> Segmentation fault
>
> $ echo foobar | column --columns 10
> column: bad columns width value: '(null)': Invalid argument
>
> $ echo foobar | column --columns=10
> column: option '--columns' doesn't allow an argument
>
> Looks like a simple case of missing has_arg flag in the "struct option"
> initialization for these two options. The patch just adds the flag. I
> haven't done thorough testing of the patched code, but it seems to work
> OK and it no longer segfaults or tries to dereference a null pointer.
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-14 16:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 9:57 column --separator segfaults (patch attached) B Watson
2012-08-14 16:30 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).