* [PATCH] cifscreds: check optind before accessing argv[optind]
@ 2018-01-23 0:48 Ronnie Sahlberg
[not found] ` <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ronnie Sahlberg @ 2018-01-23 0:48 UTC (permalink / raw)
To: linux-cifs; +Cc: Pavel Shilovsky
Redhat bugzilla: 1278543
This fixes a segfault for some incorrect usage, for example
cifscreds -u test
Signed-off-by: Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
cifscreds.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cifscreds.c b/cifscreds.c
index 5d84c3c..32f2ee4 100644
--- a/cifscreds.c
+++ b/cifscreds.c
@@ -487,6 +487,9 @@ int main(int argc, char **argv)
}
}
+ if (optind >= argc)
+ return usage();
+
/* find the best fit command */
best = NULL;
n = strnlen(argv[optind], MAX_COMMAND_SIZE);
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw@mail.gmail.com>]
[parent not found: <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] cifscreds: check optind before accessing argv[optind] [not found] ` <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2018-01-23 0:57 ` Ronnie Sahlberg [not found] ` <1836982403.1740018.1516669060551.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Ronnie Sahlberg @ 2018-01-23 0:57 UTC (permalink / raw) To: Steve French; +Cc: CIFS, Pavel Shilovsky ----- Original Message ----- > From: "Steve French" <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > To: "Ronnie Sahlberg" <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: "CIFS" <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, "Pavel Shilovsky" <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Sent: Tuesday, 23 January, 2018 11:50:38 AM > Subject: Re: [PATCH] cifscreds: check optind before accessing argv[optind] > > I would like to add cc stable. Ok? SGTM > > On Jan 22, 2018 18:48, "Ronnie Sahlberg" <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > > > Redhat bugzilla: 1278543 > > > > This fixes a segfault for some incorrect usage, for example > > cifscreds -u test > > > > Signed-off-by: Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > > --- > > cifscreds.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/cifscreds.c b/cifscreds.c > > index 5d84c3c..32f2ee4 100644 > > --- a/cifscreds.c > > +++ b/cifscreds.c > > @@ -487,6 +487,9 @@ int main(int argc, char **argv) > > } > > } > > > > + if (optind >= argc) > > + return usage(); > > + > > /* find the best fit command */ > > best = NULL; > > n = strnlen(argv[optind], MAX_COMMAND_SIZE); > > -- > > 2.15.1 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1836982403.1740018.1516669060551.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] cifscreds: check optind before accessing argv[optind] [not found] ` <1836982403.1740018.1516669060551.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2018-01-23 0:59 ` Steve French 0 siblings, 0 replies; 3+ messages in thread From: Steve French @ 2018-01-23 0:59 UTC (permalink / raw) To: Ronnie Sahlberg; +Cc: CIFS, Pavel Shilovsky sorry - I misread this. Userspace patch doersn't need the cc: but in any case can add my reviewed-by On Mon, Jan 22, 2018 at 6:57 PM, Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > > > > > ----- Original Message ----- >> From: "Steve French" <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> To: "Ronnie Sahlberg" <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> Cc: "CIFS" <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, "Pavel Shilovsky" <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> Sent: Tuesday, 23 January, 2018 11:50:38 AM >> Subject: Re: [PATCH] cifscreds: check optind before accessing argv[optind] >> >> I would like to add cc stable. Ok? > > SGTM > >> >> On Jan 22, 2018 18:48, "Ronnie Sahlberg" <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: >> >> > Redhat bugzilla: 1278543 >> > >> > This fixes a segfault for some incorrect usage, for example >> > cifscreds -u test >> > >> > Signed-off-by: Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> > --- >> > cifscreds.c | 3 +++ >> > 1 file changed, 3 insertions(+) >> > >> > diff --git a/cifscreds.c b/cifscreds.c >> > index 5d84c3c..32f2ee4 100644 >> > --- a/cifscreds.c >> > +++ b/cifscreds.c >> > @@ -487,6 +487,9 @@ int main(int argc, char **argv) >> > } >> > } >> > >> > + if (optind >= argc) >> > + return usage(); >> > + >> > /* find the best fit command */ >> > best = NULL; >> > n = strnlen(argv[optind], MAX_COMMAND_SIZE); >> > -- >> > 2.15.1 >> > >> > -- >> > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in >> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html >> > >> -- Thanks, Steve ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-23 0:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-23 0:48 [PATCH] cifscreds: check optind before accessing argv[optind] Ronnie Sahlberg
[not found] ` <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw@mail.gmail.com>
[not found] ` <CAH2r5ms-rpxf5E_XZc1W+h1tMmV26WEbXWCxEfYa+cA7PX-VTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-23 0:57 ` Ronnie Sahlberg
[not found] ` <1836982403.1740018.1516669060551.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-23 0:59 ` Steve French
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox