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

John Kåre Alsaker john.kare.alsaker at gmail.com
Fri Oct 12 22:17:35 PDT 2012


On Fri, Oct 12, 2012 at 3:05 PM, Rob Bradford <robert.bradford at intel.com> wrote:
> 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.
My latest 13 patches just fixes issues reported by Clang's static analyzer.

>
> Cheerio,
>
> Rob


More information about the wayland-devel mailing list