summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2013-01-28 21:38:12 -0500
committerJeff Layton <jlayton@samba.org>2013-01-28 21:38:12 -0500
commitfb9999a9d20495719f3fa323401b087ebef60a0d (patch)
treeba1c28ff7dd624b6a5eb7e5097baa2f6d4a404f9
parent1a01f7c4b90695211d12291d7a24bec05b1f2922 (diff)
downloadcifs-utils-fb9999a9d20495719f3fa323401b087ebef60a0d.tar.gz
cifs-utils-fb9999a9d20495719f3fa323401b087ebef60a0d.tar.bz2
cifs-utils-fb9999a9d20495719f3fa323401b087ebef60a0d.zip
setcifsacl: fix infinite loop in getnumcaces
Jian pointed out that this loop can cycle infinitely when the string contains a ','. Also, fix typo in manpage that shows a trailing ',' in one example. Reported-by: Jian Li <jiali@redhat.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r--setcifsacl.1.in2
-rw-r--r--setcifsacl.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/setcifsacl.1.in b/setcifsacl.1.in
index 5ede36a..d53a6ec 100644
--- a/setcifsacl.1.in
+++ b/setcifsacl.1.in
@@ -94,7 +94,7 @@ Set an ACL
.br
setcifsacl -S "ACL:CIFSTESTDOM\\Administrator:0x0/0x0/FULL,
.br
-ACL:CIFSTESTDOM\\user2:0x0/0x0/FULL," <file_name>
+ACL:CIFSTESTDOM\\user2:0x0/0x0/FULL" <file_name>
.PP
.SH "NOTES"
.PP
diff --git a/setcifsacl.c b/setcifsacl.c
index 211c1af..7f92b91 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -642,8 +642,10 @@ get_numcaces(const char *aces)
const char *current;
current = aces;
- while((current = strchr(current, ',')))
+ while((current = strchr(current, ','))) {
+ ++current;
++num;
+ }
return num;
}