aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src/vlib/unix
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/unix')
-rw-r--r--src/vlib/unix/cj.c2
-rw-r--r--src/vlib/unix/cli.c4
-rwxr-xr-xsrc/vlib/unix/main.c2
-rw-r--r--src/vlib/unix/mc_socket.c18
4 files changed, 13 insertions, 13 deletions
diff --git a/src/vlib/unix/cj.c b/src/vlib/unix/cj.c
index 7757146c7a7..7238dbfac38 100644
--- a/src/vlib/unix/cj.c
+++ b/src/vlib/unix/cj.c
@@ -97,7 +97,7 @@ cj_config (vlib_main_t * vm, unformat_input_t * input)
cjm->num_records = max_pow2 (cjm->num_records);
vec_validate (cjm->records, cjm->num_records - 1);
- memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
+ clib_memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
cjm->tail = ~0;
cjm->enable = enable;
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 2fe33cc54fb..56afbc2089b 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2728,7 +2728,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
}
pool_get (cm->cli_file_pool, cf);
- memset (cf, 0, sizeof (*cf));
+ clib_memset (cf, 0, sizeof (*cf));
template.read_function = unix_cli_read_ready;
template.write_function = unix_cli_write_ready;
@@ -2918,7 +2918,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
if (isatty (STDIN_FILENO) && um->cli_line_mode == 0)
{
/* Capture terminal resize events */
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_handler = unix_cli_resize_interrupt;
if (sigaction (SIGWINCH, &sa, 0) < 0)
clib_panic ("sigaction");
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 24208617fa4..45b12cd5b77 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -172,7 +172,7 @@ setup_signal_handlers (unix_main_t * um)
for (i = 1; i < 32; i++)
{
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = (void *) unix_signal_handler;
sa.sa_flags = SA_SIGINFO;
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index 1da19a5e773..c820981dae0 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -85,7 +85,7 @@ sendmsg_helper (mc_socket_main_t * msm,
struct msghdr h;
word n_bytes, n_bytes_tx, n_retries;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
h.msg_name = tx_addr;
h.msg_namelen = sizeof (tx_addr[0]);
@@ -146,7 +146,7 @@ tx_ack (void *transport, mc_peer_id_t dest_peer_id, u32 buffer_index)
vlib_main_t *vm = msm->mc_main.vlib_main;
clib_error_t *error;
- memset (&tx_addr, 0, sizeof (tx_addr));
+ clib_memset (&tx_addr, 0, sizeof (tx_addr));
tx_addr.sin_family = AF_INET;
tx_addr.sin_addr.s_addr = mc_socket_peer_id_get_address (dest_peer_id);
tx_addr.sin_port = mc_socket_peer_id_get_port (dest_peer_id);
@@ -197,7 +197,7 @@ recvmsg_helper (mc_socket_main_t * msm,
{
struct msghdr h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
if (rx_addr)
{
h.msg_name = rx_addr;
@@ -570,7 +570,7 @@ catchup_listen_read_ready (clib_file_t * uf)
clib_file_t template = { 0 };
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (c[0]));
+ clib_memset (c, 0, sizeof (c[0]));
client_len = sizeof (client_addr);
@@ -632,7 +632,7 @@ find_and_bind_to_free_port (word sock, word port)
{
struct sockaddr_in a;
- memset (&a, 0, sizeof (a)); /* Warnings be gone */
+ clib_memset (&a, 0, sizeof (a)); /* Warnings be gone */
a.sin_family = PF_INET;
a.sin_addr.s_addr = INADDR_ANY;
@@ -672,7 +672,7 @@ setup_mutlicast_socket (mc_socket_main_t * msm,
0)
return clib_error_return_unix (0, "%s setsockopt SO_REUSEADDR", type);
- memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
+ clib_memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
ms->tx_addr.sin_family = AF_INET;
ms->tx_addr.sin_addr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
@@ -682,7 +682,7 @@ setup_mutlicast_socket (mc_socket_main_t * msm,
sizeof (ms->tx_addr)) < 0)
return clib_error_return_unix (0, "%s bind", type);
- memset (&mcast_req, 0, sizeof (mcast_req));
+ clib_memset (&mcast_req, 0, sizeof (mcast_req));
mcast_req.imr_multiaddr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
mcast_req.imr_interface.s_addr = msm->if_ip4_address_net_byte_order;
@@ -852,7 +852,7 @@ catchup_request_fun (void *transport_main,
int one = 1;
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->socket = socket (AF_INET, SOCK_STREAM, 0);
if (c->socket < 0)
@@ -867,7 +867,7 @@ catchup_request_fun (void *transport_main,
return 0;
}
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = mc_socket_peer_id_get_address (catchup_peer_id);
addr.sin_port = mc_socket_peer_id_get_port (catchup_peer_id);