Message ID | 20180123004801.10182-1-lsahlber@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
----- Original Message ----- > From: "Steve French" <smfrench@gmail.com> > To: "Ronnie Sahlberg" <lsahlber@redhat.com> > Cc: "CIFS" <linux-cifs@vger.kernel.org>, "Pavel Shilovsky" <piastryyy@gmail.com> > 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@redhat.com> wrote: > > > Redhat bugzilla: 1278543 > > > > This fixes a segfault for some incorrect usage, for example > > cifscreds -u test > > > > Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> > > --- > > 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@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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@redhat.com> wrote: > > > > > ----- Original Message ----- >> From: "Steve French" <smfrench@gmail.com> >> To: "Ronnie Sahlberg" <lsahlber@redhat.com> >> Cc: "CIFS" <linux-cifs@vger.kernel.org>, "Pavel Shilovsky" <piastryyy@gmail.com> >> 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@redhat.com> wrote: >> >> > Redhat bugzilla: 1278543 >> > >> > This fixes a segfault for some incorrect usage, for example >> > cifscreds -u test >> > >> > Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> >> > --- >> > 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@vger.kernel.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html >> > >>
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);
Redhat bugzilla: 1278543 This fixes a segfault for some incorrect usage, for example cifscreds -u test Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> --- cifscreds.c | 3 +++ 1 file changed, 3 insertions(+)