From 01cf93f20e00b1c421ad90b68c338d35e45dbd59 Mon Sep 17 00:00:00 2001
From: Adam Borowski <kilobyte@angband.pl>
Date: Mon, 22 Jul 2019 17:36:40 +0200
Subject: [PATCH] examples: array: avoid a benign strncpy warning

We fix up the missing null-terminator in the next line.
---
 src/examples/libpmemobj/array/array.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/examples/libpmemobj/array/array.c b/src/examples/libpmemobj/array/array.c
index 993ada237..a306fb69a 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;
-- 
GitLab