laforge has uploaded this change for review.

View Change

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
---
M src/octoi/octoi_sock.c
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/88/27988/1
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 @@
} 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;

To view, visit change 27988. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I5f5ed937643162d6ef6ce0cf2908432c007943c1
Gerrit-Change-Number: 27988
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-MessageType: newchange