diff options
author | Andriy Gelman <andriy.gelman@gmail.com> | 2019-08-08 10:37:10 -0400 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-09 23:18:58 +0200 |
commit | 90e965be6d90fcf729b020dba675b062b59ee17d (patch) | |
tree | c1b288e9f001c1fd47d3984f58b7be35393e2b85 /tools | |
parent | 86d13e95e760e40b064d163755e538e58f8e76a2 (diff) | |
download | ffmpeg-90e965be6d90fcf729b020dba675b062b59ee17d.tar.gz |
tools/zmqsend: Avoid mem copy past the end of input buffer
This patch avoids a read past the end of the input buffer in memcpy since the size
of the received zmq message is recv_buf_size - 1.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/zmqsend.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/zmqsend.c b/tools/zmqsend.c index 7bd7fe4199..f26fa9c1c2 100644 --- a/tools/zmqsend.c +++ b/tools/zmqsend.c @@ -155,7 +155,7 @@ int main(int argc, char **argv) ret = 1; goto end; } - memcpy(recv_buf, zmq_msg_data(&msg), recv_buf_size); + memcpy(recv_buf, zmq_msg_data(&msg), recv_buf_size - 1); recv_buf[recv_buf_size-1] = 0; printf("%s\n", recv_buf); zmq_msg_close(&msg); |