All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: jiali-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH] setcifsacl: fix infinite loop in getnumcaces
Date: Tue, 29 Jan 2013 07:17:29 -0500	[thread overview]
Message-ID: <1359461849-9164-1-git-send-email-jlayton@samba.org> (raw)

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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
---
 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," <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;
 }
-- 
1.7.11.7

             reply	other threads:[~2013-01-29 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 12:17 Jeff Layton [this message]
     [not found] ` <1359461849-9164-1-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
2013-01-29 13:55   ` [PATCH] setcifsacl: fix infinite loop in getnumcaces Shirish Pargaonkar
     [not found]     ` <CADT32eKvsFwUWCdWzTGwVdiSYekN59tEHuBdbkh18JHq9UmAOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-30  0:19       ` Jeff Layton
     [not found]         ` <20130129191911.13536572-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-01-30  2:25           ` Shirish Pargaonkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359461849-9164-1-git-send-email-jlayton@samba.org \
    --to=jlayton-eunubhrolfbytjvyw6ydsg@public.gmane.org \
    --cc=jiali-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.