The kernel-provided congestion control algorithm (RTAX_CC_ALGO) is stored in
an EAF_TYPE_STRING adata blob without the terminating NULL. When exporting
metrics back to netlink, the value is treated as a C string and passed to
nl_add_attr_str(), which uses strlen(str)+1. This may read past the allocated
adata and leak adjacent memory or crash.
Minor change by committer.
}
else if (t == RTAX_CC_ALGO)
{
- struct adata *ad = lp_alloc_adata(s->pool, strlen(cc_algo));
+ struct adata *ad = lp_alloc_adata(s->pool, strlen(cc_algo) + 1);
memcpy(ad->data, cc_algo, ad->length);
ea->attrs[n++] = (eattr) {