From 9a5aef7869c4caeef09ac8b11a13c8a69cbdd926 Mon Sep 17 00:00:00 2001 From: Segwon Date: Thu, 12 Oct 2017 12:08:49 +0900 Subject: [PATCH] board: fixed to not be an unterminated array. Change-Id: If0c6aeb1a1d36392aff13f1a6564e625fbfc9cf0 Signed-off-by: Segwon --- src/daemon/peripheral_bus_board.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/daemon/peripheral_bus_board.c b/src/daemon/peripheral_bus_board.c index 3846ac3..a08ea54 100644 --- a/src/daemon/peripheral_bus_board.c +++ b/src/daemon/peripheral_bus_board.c @@ -120,7 +120,7 @@ static int peripheral_bus_board_ini_get_nkeys(dictionary *dict) static int peripheral_bus_board_get_type(void) { int fd, i, ret = 0; - char str_buf[STR_BUF_MAX + 1] = {0}; + char str_buf[STR_BUF_MAX] = {0}; int type = PB_BOARD_UNKNOWN; fd = open(BOARD_DEVICE_TREE, O_RDONLY); @@ -137,6 +137,8 @@ static int peripheral_bus_board_get_type(void) return -EIO; } + str_buf[STR_BUF_MAX - 1] = '\0'; + for (i = 0; i < PB_BOARD_UNKNOWN; i++) { if (strstr(str_buf, pb_board_type[i].name)) { type = pb_board_type[i].type; -- 2.7.4