From e215b5402b3792f4edc91f3a5d48268beebbdbce Mon Sep 17 00:00:00 2001 From: lsj119 Date: Fri, 9 Nov 2018 14:02:10 +0900 Subject: Fix bug for create_anonymous_file Change-Id: I705bb1a8836fafb6d8c1bce39dabd40b33e0e44d --- src/tbm_bufmgr_shm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tbm_bufmgr_shm.c b/src/tbm_bufmgr_shm.c index 7de5bfb..d43d38f 100644 --- a/src/tbm_bufmgr_shm.c +++ b/src/tbm_bufmgr_shm.c @@ -262,8 +262,7 @@ _shm_create_anonymous_file(off_t size) if (!name) return -1; - strncpy(name, path, strlen(path)); - strncat(name, template, sizeof(template)); + snprintf(name, strlen(path) + sizeof(template), "%s%s", path, template); fd = _shm_create_tmpfile_cloexec(name); -- cgit v1.2.3