diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2017-09-15 15:47:07 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2017-09-15 15:47:07 +0200 |
commit | cfd8e6ef491a7a5ff900ba2ba3deff7d0bebb0a6 (patch) | |
tree | 5e5696e6bc7a94fbc928bab82d3b729380d5d56e | |
parent | 7710355078e9e59bd5b338fa05179219ffd1b1b8 (diff) | |
download | attr-2.4.48.tar.gz |
attr: Fix segmentation faultv2.4.48
When the -V option is used without -s, attr will cause a segmentation
fault instead of reporting an error:
$ touch somefile
$ attr -V whatever somefile
Segmentation fault (core dumped)
https://savannah.nongnu.org/bugs/?48244
-rw-r--r-- | tools/attr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/attr.c b/tools/attr.c index d68a62c..c8aa0b4 100644 --- a/tools/attr.c +++ b/tools/attr.c @@ -157,6 +157,10 @@ main(int argc, char **argv) */ switch (opflag) { case SETOP: + if (!attrname) { + fprintf(stderr, _("-V only allowed with -s\n")); + usage(); + } if (attrvalue == NULL) { attrvalue = malloc(ATTR_MAX_VALUELEN); if (attrvalue == NULL) { |