aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stat.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-09 08:10:13 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-09 08:10:13 +0000
commit501bfe2630054f9988e08a5d77e1b1ff2abc78bb (patch)
tree433c22c02b10cffd596e2b7a54da6cba86604010 /coreutils/stat.c
parent22a80d1e7d3f83b7abc0e83e71b0056c2d18ebe3 (diff)
downloadbusybox-501bfe2630054f9988e08a5d77e1b1ff2abc78bb.tar.gz
stat: fix option -Z segv (bug 1454)
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r--coreutils/stat.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 9930d847d..7c72127c5 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -342,8 +342,11 @@ static bool do_statfs(char const *filename, char const *format)
security_context_t scontext = NULL;
if (option_mask32 & OPT_SELINUX) {
- if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext):
- getfilecon(filename, scontext))< 0) {
+ if ((option_mask32 & OPT_DEREFERENCE
+ ? lgetfilecon(filename, &scontext)
+ : getfilecon(filename, &scontext)
+ ) < 0
+ ) {
bb_perror_msg(filename);
return 0;
}
@@ -448,9 +451,12 @@ static bool do_stat(char const *filename, char const *format)
security_context_t scontext = NULL;
if (option_mask32 & OPT_SELINUX) {
- if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext):
- getfilecon(filename, scontext))< 0) {
- bb_perror_msg (filename);
+ if ((option_mask32 & OPT_DEREFERENCE
+ ? lgetfilecon(filename, &scontext)
+ : getfilecon(filename, &scontext)
+ ) < 0
+ ) {
+ bb_perror_msg(filename);
return 0;
}
}