[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] find_applet_by_name: loop index should be signed
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2016-04-03 20:30:22
Message-ID: CAK1hOcPrV7DcvngrvAy0C-6NPu6LaOTSXQ1S7xJVvR_Q=_Mr4w () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks

On Sun, Apr 3, 2016 at 11:47 AM, Ron Yorston <rmy@pobox.com> wrote:
> The loop
>
>    for (j = ARRAY_SIZE(applet_nameofs)-1; j >= 0; j--) {
>
> was intended to terminate when j goes negative, so j needs to be
> signed.
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
>  libbb/appletlib.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libbb/appletlib.c b/libbb/appletlib.c
> index 4b5b09f..bb8b713 100644
> --- a/libbb/appletlib.c
> +++ b/libbb/appletlib.c
> @@ -141,7 +141,8 @@ void FAST_FUNC bb_show_usage(void)
>
>  int FAST_FUNC find_applet_by_name(const char *name)
>  {
> -       unsigned i, j, max;
> +       unsigned i, max;
> +       int j;
>         const char *p;
>
>  /* The commented-out word-at-a-time code is ~40% faster, but +160 bytes.
> --
> 2.5.5
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic