aboutsummaryrefslogtreecommitdiff
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
parent22a80d1e7d3f83b7abc0e83e71b0056c2d18ebe3 (diff)
downloadbusybox-w32-501bfe2630054f9988e08a5d77e1b1ff2abc78bb.tar.gz
busybox-w32-501bfe2630054f9988e08a5d77e1b1ff2abc78bb.tar.bz2
busybox-w32-501bfe2630054f9988e08a5d77e1b1ff2abc78bb.zip
stat: fix option -Z segv (bug 1454)
-rw-r--r--coreutils/stat.c16
-rw-r--r--libbb/make_directory.c2
2 files changed, 12 insertions, 6 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)
342 security_context_t scontext = NULL; 342 security_context_t scontext = NULL;
343 343
344 if (option_mask32 & OPT_SELINUX) { 344 if (option_mask32 & OPT_SELINUX) {
345 if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): 345 if ((option_mask32 & OPT_DEREFERENCE
346 getfilecon(filename, scontext))< 0) { 346 ? lgetfilecon(filename, &scontext)
347 : getfilecon(filename, &scontext)
348 ) < 0
349 ) {
347 bb_perror_msg(filename); 350 bb_perror_msg(filename);
348 return 0; 351 return 0;
349 } 352 }
@@ -448,9 +451,12 @@ static bool do_stat(char const *filename, char const *format)
448 security_context_t scontext = NULL; 451 security_context_t scontext = NULL;
449 452
450 if (option_mask32 & OPT_SELINUX) { 453 if (option_mask32 & OPT_SELINUX) {
451 if ((option_mask32 & OPT_DEREFERENCE ? lgetfilecon(filename, scontext): 454 if ((option_mask32 & OPT_DEREFERENCE
452 getfilecon(filename, scontext))< 0) { 455 ? lgetfilecon(filename, &scontext)
453 bb_perror_msg (filename); 456 : getfilecon(filename, &scontext)
457 ) < 0
458 ) {
459 bb_perror_msg(filename);
454 return 0; 460 return 0;
455 } 461 }
456 } 462 }
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index d540ad133..8841c95d3 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -98,6 +98,6 @@ int bb_make_directory (char *path, long mode, int flags)
98 98
99 } while (1); 99 } while (1);
100 100
101 bb_perror_msg ("cannot %s directory '%s'", fail_msg, path); 101 bb_perror_msg("cannot %s directory '%s'", fail_msg, path);
102 return -1; 102 return -1;
103} 103}