0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 20:28:43 +00:00

Not calling memcpy with n=0.

This commit is contained in:
Maria Matejka 2019-08-14 10:28:23 +02:00
parent 1c99f546bb
commit 531e0359d7
2 changed files with 10 additions and 1 deletions

View File

@ -60,6 +60,15 @@ memset32(void *D, u32 val, uint n)
dst[i] = val;
}
static inline void *
bmemcpy(void *dest, const void *src, size_t n)
{
if (n)
return memcpy(dest, src, n);
else
return dest;
}
#define ROUTER_ID_64_LENGTH 23
#endif

View File

@ -495,7 +495,7 @@ static inline void
bgp_set_attr_data(ea_list **to, struct linpool *pool, uint code, uint flags, void *data, uint len)
{
struct adata *a = lp_alloc_adata(pool, len);
memcpy(a->data, data, len);
bmemcpy(a->data, data, len);
bgp_set_attr(to, pool, code, flags, (uintptr_t) a);
}