diff options
author | Harald Welte <laforge@osmocom.org> | 2022-04-30 12:19:24 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2022-05-01 11:22:06 +0200 |
commit | 18a05ecd7cf1b57079d7793cfa49216e3de7376a (patch) | |
tree | d9932968f2c6e5aa1e4abe161d58ce25696e846c /src | |
parent | 0d813b5947c3ec7abe774a319e002e9845f1faa4 (diff) |
octoi: only memcpy() if it is present in _octoi_tx_echo()
If the caller specifies zero-length data or a NULL pointer, don't
attempt to call memcpy() on that.
Change-Id: I5f5ed937643162d6ef6ce0cf2908432c007943c1
Diffstat (limited to 'src')
-rw-r--r-- | src/octoi/octoi_sock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/octoi/octoi_sock.c b/src/octoi/octoi_sock.c index 4245d80..eac07ee 100644 --- a/src/octoi/octoi_sock.c +++ b/src/octoi/octoi_sock.c @@ -130,7 +130,8 @@ static int _octoi_tx_echo(struct octoi_peer *peer, bool is_req, uint16_t seq_nr, } u; u.echo.seq_nr = htons(seq_nr); - memcpy(u.echo.data, data, data_len); + if (data && data_len) + memcpy(u.echo.data, data, data_len); if (is_req) msgt = E1OIP_MSGT_ECHO_REQ; |