Commit: 9e997ed2f528ff50e7394b33447a91937e939cf3
Parent: 42a83dbb0cfe4d9e1613a02dbe69eec242ee0aff
Author: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2017-10-05 16:40:00
Tree: 94c6eefe56257e25c6fa5510b2968451c2edf6eb

monitor: Fix buffer overflow with unix socket If btmon uses a unix socket, which has a long pathname, then the buffer overflow occurs as below: *** strcpy_chk: buffer overflow detected ***: program terminated at 0x4C3085C: ??? (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4C34E46: __strcpy_chk (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4084FE: strcpy (string3.h:110) by 0x4084FE: control_server (control.c:1148) by 0x4029E9: main (main.c:144) This patch also gives an error and stops running when parsing command-line arguments if the unix socket pathname is too long. And this patch adds the redundant check in control_server() to prevent the regression when reusing in the future.

Diffstat

M monitor/control.c | 9 ++++++++-
M monitor/main.c | 6 ++++++

2 files changed, 14 insertions(+), 1 deletions(-)

View Full Diff | Patch