Adjust buffer size for address 46/134046/1 submit/tizen/20170616.010939
authorSunmin Lee <sunm.lee@samsung.com>
Fri, 9 Jun 2017 03:58:48 +0000 (12:58 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 14 Jun 2017 09:34:00 +0000 (18:34 +0900)
The addr gets string of address consisting of begin/end
address and '-', null character.
So the length of addrees buffer should be set to:
 ADDR_LEN * 2 + 2 (at least)

Change-Id: I6cdb8530be50c4c29fbb51a5dcb5fa8e094e5352
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
src/sys-assert/sys-assert.c

index 275653d..75c7c3b 100644 (file)
 #define PERM_LEN_DEC 4
 #ifdef ARCH_64
 #define ADDR_LEN 10
-#define ADDR_LEN_DOUBLE 20
-#define ADDR_LEN_DOUBLE_DEC 19
+#define ADDR_BUF_LEN 22
+#define ADDR_BUF_LEN_DEC 21
 #else
 #define ADDR_LEN 8
-#define ADDR_LEN_DOUBLE 16
-#define ADDR_LEN_DOUBLE_DEC 15
+#define ADDR_BUF_LEN 18
+#define ADDR_BUF_LEN_DEC 17
 #endif
 #define INFO_LEN 20
 #define INFO_LEN_DEC 19
@@ -333,7 +333,7 @@ static struct addr_node *get_addr_list_from_maps(int fd)
        long *eaddr;
        char perm[PERM_LEN];
        char path[PATH_MAX + 1];
-       char addr[ADDR_LEN * 2];
+       char addr[ADDR_BUF_LEN];
        char linebuf[BUF_SIZE];
        struct addr_node *head = NULL;
        struct addr_node *tail = NULL;
@@ -342,7 +342,7 @@ static struct addr_node *get_addr_list_from_maps(int fd)
        /* parsing the maps to get executable code address */
        while (fgets_fd(linebuf, BUF_SIZE, fd) != NULL) {
                memset(path, 0, PATH_MAX + 1);
-               result = sscanf(linebuf, STR_FS(ADDR_LEN_DOUBLE_DEC)
+               result = sscanf(linebuf, STR_FS(ADDR_BUF_LEN_DEC)
                                STR_FS(PERM_LEN_DEC)
                                "%*s %*s %*s"
                                STR_FS(PATH_MAX), addr, perm, path);