board: fixed to not be an unterminated array. 41/155041/1 submit/tizen/20171012.141835
authorSegwon <segwon.han@samsung.com>
Thu, 12 Oct 2017 03:08:49 +0000 (12:08 +0900)
committerSegwon <segwon.han@samsung.com>
Thu, 12 Oct 2017 03:08:49 +0000 (12:08 +0900)
Change-Id: If0c6aeb1a1d36392aff13f1a6564e625fbfc9cf0
Signed-off-by: Segwon <segwon.han@samsung.com>
src/daemon/peripheral_bus_board.c

index 3846ac3..a08ea54 100644 (file)
@@ -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;