Previously, when aspath->str was longer than sizeof(api.opaque.data), we
were overwriting the wrong memory.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
struct aspath *aspath = info->attr->aspath;
SET_FLAG(api.message, ZAPI_MESSAGE_OPAQUE);
- api.opaque.length = strlen(aspath->str) + 1;
- memcpy(api.opaque.data, aspath->str, api.opaque.length);
+ strlcpy((char *)api.opaque.data, aspath->str,
+ sizeof(api.opaque.data));
+ api.opaque.length = strlen((char *)api.opaque.data) + 1;
}
if (allow_recursion)