summaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/mc_socket.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-04 22:40:45 +0200
committerDamjan Marion <dmarion@me.com>2022-04-04 23:17:13 +0000
commit8bea589cfe0fca1a6f560e16ca66a4cf199041a2 (patch)
treecf2767f8f5f31344468b65e14baa3f1a4c85fb91 /src/vlib/unix/mc_socket.c
parenta2b358b1faf6e762e1d29a931d83c7735ac9a77d (diff)
vppinfra: make _vec_len() read-only
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/unix/mc_socket.c')
-rw-r--r--src/vlib/unix/mc_socket.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index 9800b1e744c..1f3b4e9a8f1 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -90,7 +90,7 @@ sendmsg_helper (mc_socket_main_t * msm,
h.msg_namelen = sizeof (tx_addr[0]);
if (msm->iovecs)
- _vec_len (msm->iovecs) = 0;
+ vec_set_len (msm->iovecs, 0);
n_bytes = append_buffer_index_to_iovec (vm, buffer_index, &msm->iovecs);
ASSERT (n_bytes <= msm->mc_main.transport.max_packet_size);
@@ -177,7 +177,7 @@ recvmsg_helper (mc_socket_main_t * msm,
vec_validate (msm->rx_buffers, max_alloc - 1);
n_alloc =
vlib_buffer_alloc (vm, msm->rx_buffers + n_left, max_alloc - n_left);
- _vec_len (msm->rx_buffers) = n_left + n_alloc;
+ vec_set_len (msm->rx_buffers, n_left + n_alloc);
}
ASSERT (vec_len (msm->rx_buffers) >= n_mtu);
@@ -192,7 +192,7 @@ recvmsg_helper (mc_socket_main_t * msm,
msm->iovecs[i].iov_base = b->data;
msm->iovecs[i].iov_len = buffer_size;
}
- _vec_len (msm->iovecs) = n_mtu;
+ vec_set_len (msm->iovecs, n_mtu);
{
struct msghdr h;
@@ -237,7 +237,7 @@ recvmsg_helper (mc_socket_main_t * msm,
b->next_buffer = msm->rx_buffers[i_rx];
}
- _vec_len (msm->rx_buffers) = i_rx;
+ vec_set_len (msm->rx_buffers, i_rx);
return 0 /* no error */ ;
}
@@ -418,7 +418,7 @@ catchup_socket_read_ready (clib_file_t * uf, int is_server)
}
}
- _vec_len (c->input_vector) = l + n;
+ vec_set_len (c->input_vector, l + n);
if (is_eof && vec_len (c->input_vector) > 0)
{
@@ -426,7 +426,7 @@ catchup_socket_read_ready (clib_file_t * uf, int is_server)
{
mc_msg_catchup_request_handler (mcm, (void *) c->input_vector,
c - msm->catchups);
- _vec_len (c->input_vector) = 0;
+ vec_set_len (c->input_vector, 0);
}
else
{