[krh/wayland/next 1/5] connection: Don't call memcpy with null pointer.

Rob Bradford robert.bradford at intel.com
Fri Oct 12 06:05:16 PDT 2012


On 12 October 2012 10:28, John Kåre Alsaker <john.kare.alsaker at gmail.com> wrote:

> -                       if (length > 0)
> +                       if (length > 0) {
> +                               memcpy(p, s, length);
>                                 *sp = (const char *) p;
> -                       else
> +                       } else
>                                 *sp = NULL;
>
> -                       memcpy(p, s, length);
>                         memset((char *) p + length, 0, aligned - length);
>                         p += aligned / sizeof *p;
>                         break;

Out of interest - did you end up on something where this memcpy with
length == 0 cause problems? This came up under static analysis tool
too.

Cheerio,

Rob


More information about the wayland-devel mailing list