diff --git a/src/examples/libpmemobj/array/array.c b/src/examples/libpmemobj/array/array.c index 993ada237d9fb1074cabd6d27f85e6344a3d0a0a..a306fb69aa3c51f87b224e72a52fb9ce67743f45 100644 --- a/src/examples/libpmemobj/array/array.c +++ b/src/examples/libpmemobj/array/array.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, Intel Corporation + * Copyright 2016-2019, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -471,7 +471,7 @@ do_alloc(int argc, char *argv[]) POBJ_FREE(&array_info); POBJ_ZNEW(pop, &array_info, struct array_info); struct array_info *info = D_RW(array_info); - strncpy(info->name, argv[0], MAX_BUFFLEN); + strncpy(info->name, argv[0], MAX_BUFFLEN - 1); info->name[MAX_BUFFLEN - 1] = '\0'; info->size = size; info->type = type; diff --git a/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c b/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c index 8a9e99ad8983a0473932d5145126baa510c01820..5267626d23b18cf46e586c3583a29bc0eec5efa2 100644 --- a/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c +++ b/src/examples/libpmemobj/pmemobjfs/pmemobjfs.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017, Intel Corporation + * Copyright 2015-2019, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -2377,8 +2377,8 @@ pmemobjfs_tx_ioctl(const char *dir, int req) if (!path) return -1; - strncpy(path, dir, dirlen); - strncat(path, PMEMOBJFS_TMP_TEMPLATE, tmpllen); + memcpy(path, dir, dirlen); + strcpy(path + dirlen, PMEMOBJFS_TMP_TEMPLATE); /* create temporary file */ mode_t prev_umask = umask(S_IRWXG | S_IRWXO);