Re: [PATCH] cifscreds: check optind before accessing argv[optind]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






----- Original Message -----
> From: "Steve French" <smfrench@xxxxxxxxx>
> To: "Ronnie Sahlberg" <lsahlber@xxxxxxxxxx>
> Cc: "CIFS" <linux-cifs@xxxxxxxxxxxxxxx>, "Pavel Shilovsky" <piastryyy@xxxxxxxxx>
> 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@xxxxxxxxxx> wrote:
> 
> > Redhat bugzilla: 1278543
> >
> > This fixes a segfault for some incorrect usage, for example
> >    cifscreds -u test
> >
> > Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
> > ---
> >  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@xxxxxxxxxxxxxxx
> > 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux