summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/build.c b/src/build.c
index 5143048..c776de8 100644
--- a/src/build.c
+++ b/src/build.c
@@ -24,9 +24,12 @@ static inline void *
put_header(struct netpld *pld, int attr, size_t len)
{
struct netattr *nta = PLD_TAIL(pld);
- pld->len += NTA_ALIGN(NTA_LENGTH(len));
+ int total_size = NTA_ALIGN(NTA_LENGTH(len));
+ int attr_size = NTA_LENGTH(len);
+ pld->len += total_size;
nta->nta_attr = htons(attr);
- nta->nta_len = htons(len);
+ nta->nta_len = htons(attr_size);
+ memset((unsigned char *)nta + attr_size, 0, total_size - attr_size);
return NTA_DATA(nta);
}