From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] cmd: fastboot: Validate user input
Date: Tue, 24 Jul 2018 23:22:55 +0200 [thread overview]
Message-ID: <20180724232255.46e49a5b@jawa> (raw)
In-Reply-To: <CAKaJLVvcg8+QBVNE=GDv2vO=OeW2ThaQoTOZ5vGOtdOxzj1e6Q@mail.gmail.com>
Hi Sam,
> On Sat, Jun 30, 2018 at 7:20 AM, Simon Glass <sjg@chromium.org> wrote:
> > On 29 June 2018 at 11:59, Sam Protsenko
> > <semen.protsenko@linaro.org> wrote:
> >> In case when user provides '-' as USB controller index, like this:
> >>
> >> => fastboot -
> >>
> >> data abort occurs in strcmp() function in do_fastboot(), here:
> >>
> >> if (!strcmp(argv[1], "udp"))
> >>
> >> (tested on BeagleBone Black).
> >>
> >> That's because argv[1] is NULL when user types in the '-', and null
> >> pointer dereference occurs in strcmp() (which is ok according to C
> >> standard specification). So we must validate user input to prevent
> >> such behavior.
> >>
> >> While at it, check also the result of strtoul() function and handle
> >> error cases properly.
> >>
> >> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> >> ---
> >> Changes for v2:
> >> - replace argv check with argc check
> >> - add mentioning of testing platform in commit message
> >>
> >> cmd/fastboot.c | 13 ++++++++++++-
> >> 1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Hi Lukasz,
>
> Can you please review and merge?
I've noticed that I was not CC'ed, so I've missed the patch from the
mailing list.
You may consider using patman for sending patches (which adds
recipients automatically).
The patch itself seems OK - thanks.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
I've added it to u-boot-dfu tree. Lets wait for Travis-CI output.
>
> Thanks!
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180724/a154b52f/attachment.sig>
next prev parent reply other threads:[~2018-07-24 21:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 18:59 [U-Boot] [PATCH v2] cmd: fastboot: Validate user input Sam Protsenko
2018-06-30 4:20 ` Simon Glass
2018-07-12 19:48 ` Sam Protsenko
2018-07-24 16:39 ` Sam Protsenko
2018-07-24 21:22 ` Lukasz Majewski [this message]
2018-08-13 12:57 ` Sam Protsenko
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=20180724232255.46e49a5b@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/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.