From fb9999a9d20495719f3fa323401b087ebef60a0d Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 28 Jan 2013 21:38:12 -0500 Subject: 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 Signed-off-by: Jeff Layton --- setcifsacl.1.in | 2 +- setcifsacl.c | 4 +++- 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," +ACL:CIFSTESTDOM\\user2:0x0/0x0/FULL" .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; } -- cgit v1.2.3