From b7b929931a07fbb27b43d5cd105f366c3e29807e Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 17 Oct 2018 10:38:51 -0400 Subject: c11 safe string handling support Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach --- src/vnet/session-apps/echo_client.c | 8 ++++---- src/vnet/session-apps/echo_server.c | 10 +++++----- src/vnet/session-apps/http_server.c | 10 +++++----- src/vnet/session-apps/proxy.c | 16 ++++++++-------- 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/vnet/session-apps') diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c index c3d838d49cc..7935eb8b242 100644 --- a/src/vnet/session-apps/echo_client.c +++ b/src/vnet/session-apps/echo_client.c @@ -387,7 +387,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context, pool_get (ecm->sessions, session); clib_spinlock_unlock_if_init (&ecm->sessions_lock); - memset (session, 0, sizeof (*session)); + clib_memset (session, 0, sizeof (*session)); session_index = session - ecm->sessions; session->bytes_to_send = ecm->bytes_to_send; session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send; @@ -507,8 +507,8 @@ echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) u64 options[16]; clib_error_t *error = 0; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->api_client_index = ecm->my_client_index; a->session_cb_vft = &echo_clients; @@ -588,7 +588,7 @@ echo_clients_connect (vlib_main_t * vm, u32 n_clients) clib_error_t *error = 0; int i; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); for (i = 0; i < n_clients; i++) { a->uri = (char *) ecm->connect_uri; diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c index 14ab36d796c..3ee33ea8e29 100644 --- a/src/vnet/session-apps/echo_server.c +++ b/src/vnet/session-apps/echo_server.c @@ -287,8 +287,8 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) u64 options[APP_OPTIONS_N_OPTIONS]; u32 segment_size = 512 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (esm->no_echo) echo_server_session_cb_vft.builtin_app_rx_callback = @@ -327,13 +327,13 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) } esm->app_index = a->app_index; - memset (a_cert, 0, sizeof (*a_cert)); + clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; vec_validate (a_cert->cert, test_srv_crt_rsa_len); clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len); vnet_app_add_tls_cert (a_cert); - memset (a_key, 0, sizeof (*a_key)); + clib_memset (a_key, 0, sizeof (*a_key)); a_key->app_index = a->app_index; vec_validate (a_key->key, test_srv_key_rsa_len); clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len); @@ -359,7 +359,7 @@ echo_server_listen () { echo_server_main_t *esm = &echo_server_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = esm->app_index; a->uri = esm->server_uri; return vnet_bind_uri (a); diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c index ef9f760c992..8501cb4ee70 100644 --- a/src/vnet/session-apps/http_server.c +++ b/src/vnet/session-apps/http_server.c @@ -498,8 +498,8 @@ server_attach () vnet_app_attach_args_t _a, *a = &_a; u32 segment_size = 128 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (hsm->private_segment_size) segment_size = hsm->private_segment_size; @@ -522,13 +522,13 @@ server_attach () } hsm->app_index = a->app_index; - memset (a_cert, 0, sizeof (*a_cert)); + clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; vec_validate (a_cert->cert, test_srv_crt_rsa_len); clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len); vnet_app_add_tls_cert (a_cert); - memset (a_key, 0, sizeof (*a_key)); + clib_memset (a_key, 0, sizeof (*a_key)); a_key->app_index = a->app_index; vec_validate (a_key->key, test_srv_key_rsa_len); clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len); @@ -542,7 +542,7 @@ http_server_listen () { http_server_main_t *hsm = &http_server_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = hsm->app_index; a->uri = "tcp://0.0.0.0/80"; if (hsm->uri) diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c index 6260ad350f0..f7896a5b0ae 100644 --- a/src/vnet/session-apps/proxy.c +++ b/src/vnet/session-apps/proxy.c @@ -116,7 +116,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open) if (ps) { if (CLIB_DEBUG > 0) - memset (ps, 0xFE, sizeof (*ps)); + clib_memset (ps, 0xFE, sizeof (*ps)); pool_put (pm->sessions, ps); } @@ -235,11 +235,11 @@ proxy_rx_callback (stream_session_t * s) /* $$$ your message in this space: parse url, etc. */ - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); clib_spinlock_lock_if_init (&pm->sessions_lock); pool_get (pm->sessions, ps); - memset (ps, 0, sizeof (*ps)); + clib_memset (ps, 0, sizeof (*ps)); ps->server_rx_fifo = rx_fifo; ps->server_tx_fifo = tx_fifo; ps->vpp_server_handle = session_handle (s); @@ -397,8 +397,8 @@ proxy_server_attach () vnet_app_attach_args_t _a, *a = &_a; u32 segment_size = 512 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (pm->private_segment_size) segment_size = pm->private_segment_size; @@ -431,8 +431,8 @@ active_open_attach (void) vnet_app_attach_args_t _a, *a = &_a; u64 options[16]; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->api_client_index = pm->active_open_client_index; a->session_cb_vft = &active_open_clients; @@ -463,7 +463,7 @@ proxy_server_listen () { proxy_main_t *pm = &proxy_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = pm->server_app_index; a->uri = (char *) pm->server_uri; return vnet_bind_uri (a); -- cgit 1.2.3-korg