[lldp-devel] [PATCH] lldpad: Fix size of memcpy in init_oper_apptlv

Mark Rustad mark.d.rustad at intel.com
Thu Mar 21 20:17:31 UTC 2013


Signed-off-by: Mark Rustad <mark.d.rustad at intel.com>
Reviewed-by: john.r.fastabend at intel.com
Tested-by: Jack Morgan <jack.morgan at intel.com>
---

 dcb_protocol.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/dcb_protocol.c b/dcb_protocol.c
index c6e2c04..1e110a6 100644
--- a/dcb_protocol.c
+++ b/dcb_protocol.c
@@ -533,12 +533,10 @@ void init_oper_apptlv(app_attribs *Store, u32 Subtype)
 	memset(Store,0,sizeof(*Store));
 
 	app_it itapp = apptlv_find(&oper_apptlv, DEF_CFG_STORE, Subtype);
-	if (itapp == NULL) {
+	if (!itapp)
 		return;
-	}
-	Store->Length =itapp->second->Length;
-	memcpy(&(Store->AppData), &(itapp->second->AppData),
-			sizeof(Store->Length));
+	Store->Length = itapp->second->Length;
+	memcpy(&Store->AppData, &itapp->second->AppData, Store->Length);
 }
 
 bool add_oper_apptlv(char *device_name, u32 Subtype)



More information about the lldp-devel mailing list