]> git.ipfire.org Git - thirdparty/util-linux.git/commit
column: --separator segfaults
authorB Watson <yalhcru@gmail.com>
Tue, 14 Aug 2012 16:27:09 +0000 (18:27 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Aug 2012 16:27:09 +0000 (18:27 +0200)
commit43f8915c51f1b36c3d1d79d06d58ea5fb27a6cca
tree11320aa1c7e61345d2726b95a62ae294098d922f
parentf31322a28922d51e8b32e7e9107ed403b8f2e359
column: --separator segfaults

The --separator and --columns long options in util-linux-2.21.2 and in
a git clone from 5 minutes ago, don't work:

$ echo foobar | column -s x
foobar

$ echo foobar | column -c 10
foobar

$ 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.

Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/column.c