24 lines
734 B
Diff
24 lines
734 B
Diff
|
From cf1da68e3103022f93680208de24304726276936 Mon Sep 17 00:00:00 2001
|
||
|
From: marxin <mliska@suse.cz>
|
||
|
Date: Thu, 7 Mar 2019 10:33:29 +0100
|
||
|
Subject: [PATCH] Fix #23 by off by one strncpy value.
|
||
|
|
||
|
---
|
||
|
lldp_dcbx_nl.c | 3 ++-
|
||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/lldp_dcbx_nl.c b/lldp_dcbx_nl.c
|
||
|
index 7a2dad2..357da9c 100644
|
||
|
--- a/lldp_dcbx_nl.c
|
||
|
+++ b/lldp_dcbx_nl.c
|
||
|
@@ -561,7 +561,8 @@ int get_dcb_numtcs(const char *ifname, u8 *pgtcs, u8 *pfctcs)
|
||
|
|
||
|
seq = nlh->nlmsg_seq;
|
||
|
|
||
|
- strncpy(name, ifname, sizeof(name));
|
||
|
+ strncpy(name, ifname, sizeof(name) - 1);
|
||
|
+ name[sizeof(name) - 1] = '\0';
|
||
|
add_rta(nlh, DCB_ATTR_IFNAME, (void *)name, strlen(name) + 1);
|
||
|
rta_parent = add_rta(nlh, DCB_ATTR_NUMTCS, NULL, 0);
|
||
|
|