c11 safe string handling support
[vpp.git] / src / plugins / memif / memif_api.c
index a48cd18..77a87cc 100644 (file)
@@ -130,7 +130,7 @@ void
   if (len > 0)
     {
       vec_validate (socket_filename, len);
-      strncpy ((char *) socket_filename, (char *) mp->socket_filename, len);
+      memcpy (socket_filename, mp->socket_filename, len);
     }
 
   rv = memif_socket_filename_add_del (is_add, socket_id, socket_filename);
@@ -224,7 +224,12 @@ vl_api_memif_create_t_handler (vl_api_memif_create_t * mp)
   vec_free (args.secret);
 
 reply:
-  REPLY_MACRO (VL_API_MEMIF_CREATE_REPLY);
+  /* *INDENT-OFF* */
+  REPLY_MACRO2 (VL_API_MEMIF_CREATE_REPLY,
+    ({
+      rmp->sw_if_index = htonl (args.sw_if_index);
+    }));
+  /* *INDENT-ON* */
 }
 
 /**
@@ -269,7 +274,7 @@ send_memif_details (vl_api_registration_t * reg,
   hwif = vnet_get_sup_hw_interface (vnm, swif->sw_if_index);
 
   mp = vl_msg_api_alloc (sizeof (*mp));
-  memset (mp, 0, sizeof (*mp));
+  clib_memset (mp, 0, sizeof (*mp));
 
   mp->_vl_msg_id = htons (VL_API_MEMIF_DETAILS + mm->msg_id_base);
   mp->context = context;
@@ -342,7 +347,7 @@ send_memif_socket_filename_details (vl_api_registration_t * reg,
   memif_main_t *mm = &memif_main;
 
   mp = vl_msg_api_alloc (sizeof (*mp));
-  memset (mp, 0, sizeof (*mp));
+  clib_memset (mp, 0, sizeof (*mp));
 
   mp->_vl_msg_id = htons (VL_API_MEMIF_SOCKET_FILENAME_DETAILS
                          + mm->msg_id_base);