[systemd-devel] [PATCH v2] sd-rtnl: fix off-by-one

Tom Gundersen teg at jklm.no
Mon Mar 31 00:55:33 PDT 2014


On Mon, Mar 31, 2014 at 6:20 AM, Steven Siloti <ssiloti at gmail.com> wrote:
> Also fix type parameter passed to new0

Thanks to both. Applied.

Cheers,

Tom

>  src/libsystemd/sd-rtnl/rtnl-message.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
> index 5265184..4ace94c 100644
> --- a/src/libsystemd/sd-rtnl/rtnl-message.c
> +++ b/src/libsystemd/sd-rtnl/rtnl-message.c
> @@ -911,11 +911,11 @@ int rtnl_message_parse(sd_rtnl_message *m,
>          unsigned short type;
>          size_t *tb;
>
> -        tb = (size_t *) new0(size_t *, max);
> +        tb = new0(size_t, max + 1);
>          if(!tb)
>                  return -ENOMEM;
>
> -        *rta_tb_size = max;
> +        *rta_tb_size = max + 1;
>
>          for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
>                  type = rta->rta_type;
> --
> 1.9.1
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list