MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_zero_m

Function sctp_zero_m

freebsd/netinet/sctp_auth.c:1551–1581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1549}
1550
1551static void
1552sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_t size)
1553{
1554 struct mbuf *m_tmp;
1555 uint8_t *data;
1556
1557 /* sanity check */
1558 if (m == NULL)
1559 return;
1560
1561 /* find the correct starting mbuf and offset (get start position) */
1562 m_tmp = m;
1563 while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) {
1564 m_offset -= SCTP_BUF_LEN(m_tmp);
1565 m_tmp = SCTP_BUF_NEXT(m_tmp);
1566 }
1567 /* now use the rest of the mbuf chain */
1568 while ((m_tmp != NULL) && (size > 0)) {
1569 data = mtod(m_tmp, uint8_t *)+m_offset;
1570 if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
1571 memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
1572 size -= SCTP_BUF_LEN(m_tmp) - m_offset;
1573 } else {
1574 memset(data, 0, size);
1575 size = 0;
1576 }
1577 /* clear the offset since it's only for the first mbuf */
1578 m_offset = 0;
1579 m_tmp = SCTP_BUF_NEXT(m_tmp);
1580 }
1581}
1582
1583/*-
1584 * process the incoming Authentication chunk

Callers 1

sctp_handle_authFunction · 0.85

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected