[PATCH][netifd] system-linux: initialize ifreq struct before using it

Hans Dedecker dedeckeh at gmail.com
Thu Oct 8 08:15:05 EDT 2020


Hi Alin,

On Thu, Oct 8, 2020 at 1:31 PM Alin Nastac <alin.nastac at gmail.com> wrote:
Could you add which issue this fixes ?

Thx
Hans
>
> Signed-off-by: Alin Nastac <alin.nastac at gmail.com>
> ---
>  system-linux.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/system-linux.c b/system-linux.c
> index 6778b1d..9188899 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -904,6 +904,8 @@ failure:
>  int system_if_resolve(struct device *dev)
>  {
>         struct ifreq ifr;
> +
> +       memset(&ifr, 0, sizeof(ifr));
>         strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
>         if (!ioctl(sock_ioctl, SIOCGIFINDEX, &ifr))
>                 return ifr.ifr_ifindex;
> --
> 2.7.4
>



More information about the openwrt-devel mailing list