[krh/wayland/next 1/5] connection: Don't call memcpy with null pointer.
Kristian Høgsberg
hoegsberg at gmail.com
Tue Oct 16 08:13:46 PDT 2012
On Fri, Oct 12, 2012 at 11:28:24AM +0200, John Kåre Alsaker wrote:
> ---
> src/connection.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/connection.c b/src/connection.c
> index 8497670..58b150b 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -486,12 +486,12 @@ wl_closure_vmarshal(struct wl_object *sender,
> goto err;
> *p++ = length;
>
> - if (length > 0)
> + if (length > 0) {
> + memcpy(p, s, length);
> *sp = (const char *) p;
> - else
> + } else
> *sp = NULL;
>
> - memcpy(p, s, length);
Sure... of course, we would only call memcpy with a NULL pointer when
length is also 0.
Kristian
> memset((char *) p + length, 0, aligned - length);
> p += aligned / sizeof *p;
> break;
> --
> 1.7.12.2
>
> _______________________________________________
> 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