[PATCH] connection: Check object types in message parameters

Kristian Høgsberg krh at bitplanet.net
Mon Oct 31 08:23:30 PDT 2011


On Mon, Oct 31, 2011 at 6:06 AM, Benjamin Franzke
<benjaminfranzke at googlemail.com> wrote:

Right, thanks.  We were always supposed to do this check, but I only
recently updated the scanner to emit the type array.

Thanks,
Kristian

> ---
>  src/connection.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/connection.c b/src/connection.c
> index 1963314..a10508d 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -594,6 +594,16 @@ wl_connection_demarshal(struct wl_connection *connection,
>                                goto err;
>                        }
>
> +                       if (*object != NULL && message->types[i-2] != NULL &&
> +                           (*object)->interface != message->types[i-2]) {
> +                               printf("invalid object (%d), type (%s), "
> +                                       "message %s(%s)\n",
> +                                      *p, (*object)->interface->name,
> +                                      message->name, message->signature);
> +                               errno = EINVAL;
> +                               goto err;
> +                       }
> +
>                        p++;
>                        break;
>                case 'n':
> --
> 1.7.3.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>


More information about the wayland-devel mailing list