[PATCH] udhcpc: fix segmentation fault on empty bin opt

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 8 13:15:10 UTC 2019


Applied, thanks

On Wed, Sep 25, 2019 at 2:03 PM Michal Kazior <kazikcz at gmail.com> wrote:
>
> From: Michal Kazior <michal at plume.com>
>
> The following caused udhcpc to segfault:
>   busybox udhcpc -i lo -s /dev/null -x 0x3d:
>
> Signed-off-by: Michal Kazior <michal at plume.com>
> ---
>  networking/udhcp/common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
> index 4a452cdb9..9ec752dfc 100644
> --- a/networking/udhcp/common.c
> +++ b/networking/udhcp/common.c
> @@ -539,7 +539,7 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg,
>
>                 if (optflag->flags == OPTION_BIN) {
>                         val = strtok(NULL, ""); /* do not split "'q w e'" */
> -                       trim(val);
> +                       if (val) trim(val);
>                 } else
>                         val = strtok(NULL, ", \t");
>                 if (!val)
> --
> 2.22.0
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list