From: Segwon Date: Thu, 12 Oct 2017 03:08:49 +0000 (+0900) Subject: board: fixed to not be an unterminated array. X-Git-Tag: submit/tizen_4.0/20171012.141856^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fa9abe05be30d786b8be38b3f39f7d272c110ae;p=platform%2Fcore%2Fsystem%2Fperipheral-bus.git board: fixed to not be an unterminated array. Change-Id: If0c6aeb1a1d36392aff13f1a6564e625fbfc9cf0 Signed-off-by: Segwon --- 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;