diff options
Diffstat (limited to 'bgpd/bgp_notification.c')
-rw-r--r-- | bgpd/bgp_notification.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/bgpd/bgp_notification.c b/bgpd/bgp_notification.c index 2dc6952e..2343c785 100644 --- a/bgpd/bgp_notification.c +++ b/bgpd/bgp_notification.c @@ -108,16 +108,15 @@ bgp_notify_dup(bgp_notify notification) duplicate = XMALLOC(MTYPE_BGP_NOTIFY, sizeof(struct bgp_notify)) ; *duplicate = *notification ; - if (notification->length == 0) + if (duplicate->length == 0) { duplicate->size = 0 ; duplicate->data = NULL ; } else { - bgp_size_t size = bgp_notify_size(duplicate->length) ; - duplicate->size = size ; - duplicate->data = XCALLOC(MTYPE_TMP, size) ; + duplicate->size = bgp_notify_size(duplicate->length) ; + duplicate->data = XCALLOC(MTYPE_TMP, duplicate->size) ; memcpy(duplicate->data, notification->data, duplicate->length) ; } ; @@ -216,13 +215,12 @@ bgp_notify_append_data(bgp_notify notification, const void* data, else notification->data = XREALLOC(MTYPE_TMP, notification->data, size) ; - memset((char*)notification + notification->size, 0, - size - notification->size) ; + memset(notification->data + new_length, 0, size - new_length) ; notification->size = size ; } ; if (len > 0) - memcpy((char*)(notification->data) + notification->length, data, len) ; + memcpy(notification->data + notification->length, data, len) ; notification->length = new_length ; } ; |