From: Darrick J. Wong Date: Tue, 27 Jan 2015 15:58:17 +0000 (-0500) Subject: debugfs: fix crash in ea_set argument handling X-Git-Tag: v1.43-WIP-2015-05-18~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0bc2c88245224e5384ac022ac0ce6b9aae03c12;p=thirdparty%2Fe2fsprogs.git debugfs: fix crash in ea_set argument handling Fix an incorrect check in ea_set that would crash debugfs if someone runs 'ea_set / foo.bar' (i.e. with no value argument) Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/xattrs.c b/debugfs/xattrs.c index a80fd0b84..e71bc1577 100644 --- a/debugfs/xattrs.c +++ b/debugfs/xattrs.c @@ -202,7 +202,7 @@ void do_set_xattr(int argc, char **argv) } } - if (optind != argc - 2 && optind != argc - 3) { + if (!(fp && optind == argc - 2) && !(!fp && optind == argc - 3)) { printf("%s: Usage: %s [-f infile | value>]\n", argv[0], argv[0]); goto out2;