diff options
author | David Timber <mieabby@gmail.com> | 2020-08-31 02:34:11 +0930 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-08-31 02:34:11 +0930 |
commit | ff4d91db20381471493b4f485fa0f75390138e54 (patch) | |
tree | a6e4c85419e7e4400b9de44d593dff867e05d182 /src/protocol.c | |
parent | fbb4d5d648a8dc6dba9e33240bf66d82939e2880 (diff) |
Impl run_bin
Diffstat (limited to 'src/protocol.c')
-rw-r--r-- | src/protocol.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/protocol.c b/src/protocol.c index 301e884..5388f52 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -711,12 +711,14 @@ prne_htbt_ser_rc_t prne_htbt_dser_cmd (const uint8_t *data, const size_t len, si return PRNE_HTBT_SER_RC_MORE_BUF; } - mem = (char*)prne_malloc(1, args_len); - if (mem == NULL) { - ret = PRNE_HTBT_SER_RC_ERRNO; - goto END; + if (args_len > 0) { + mem = (char*)prne_malloc(1, args_len); + if (mem == NULL) { + ret = PRNE_HTBT_SER_RC_ERRNO; + goto END; + } + memcpy(mem, data + 2, args_len); } - memcpy(mem, data + 2, args_len); saved_errno = errno; errno = 0; |