From bec2d4582f9fe4b467709501e91e804ec1c5d21e Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Mon, 23 Sep 2013 15:39:23 +0200 Subject: hexdump: use xstrncpy in add() Signed-off-by: Ondrej Oprala --- text-utils/parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'text-utils/parse.c') diff --git a/text-utils/parse.c b/text-utils/parse.c index 2557210a2..24a8407af 100644 --- a/text-utils/parse.c +++ b/text-utils/parse.c @@ -44,6 +44,7 @@ #include "hexdump.h" #include "nls.h" #include "xalloc.h" +#include "strutils.h" static void escape(char *p1); static void badcnt(const char *s); @@ -148,8 +149,7 @@ void add(const char *fmt) badfmt(fmt); } tfu->fmt = xmalloc(p - savep + 1); - strncpy(tfu->fmt, (char *)savep, p - savep); - tfu->fmt[p - savep] = '\0'; + xstrncpy(tfu->fmt, (char *)savep, p - savep + 1); escape(tfu->fmt); ++p; } -- cgit v1.2.3-55-g7522