mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
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>
This commit is contained in:
parent
86d13e95e7
commit
90e965be6d
@ -155,7 +155,7 @@ int main(int argc, char **argv)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
goto end;
|
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;
|
recv_buf[recv_buf_size-1] = 0;
|
||||||
printf("%s\n", recv_buf);
|
printf("%s\n", recv_buf);
|
||||||
zmq_msg_close(&msg);
|
zmq_msg_close(&msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user