Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Replace strncpy w/ memcpy to avoid -Wstringop-truncation



From: Wesley Schwengle <wesley@xxxxxxxxxxxxx>

Signed-off-by: Wesley Schwengle <wesley@xxxxxxxxxxxxx>
---
 Src/params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/params.c b/Src/params.c
index 089a958ae..66e00e422 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2585,7 +2585,7 @@ assignstrvalue(Value v, char *val, int flags)
 		Param pm = v->pm;
                 /* Size doesn't change, can limit actions to only
                  * overwriting bytes in already allocated string */
-                strncpy(z + v->start, val, vlen);
+                memcpy(z + v->start, val, vlen);
 		/* Implement remainder of strsetfn */
 		if (!(pm->node.flags & PM_HASHELEM) &&
 		    ((pm->node.flags & PM_NAMEDDIR) ||
-- 
2.21.0.196.g041f5ea1cf



Messages sorted by: Reverse Date, Date, Thread, Author