diff options
author | Ondrej Oprala | 2013-09-23 15:39:23 +0200 |
---|---|---|
committer | Karel Zak | 2013-11-08 12:54:53 +0100 |
commit | bec2d4582f9fe4b467709501e91e804ec1c5d21e (patch) | |
tree | 8d633447884b452cc4778e95fbf3bce4b4ffa35a /text-utils/parse.c | |
parent | hexdump: simplify newsyntax arguments (diff) | |
download | kernel-qcow2-util-linux-bec2d4582f9fe4b467709501e91e804ec1c5d21e.tar.gz kernel-qcow2-util-linux-bec2d4582f9fe4b467709501e91e804ec1c5d21e.tar.xz kernel-qcow2-util-linux-bec2d4582f9fe4b467709501e91e804ec1c5d21e.zip |
hexdump: use xstrncpy in add()
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'text-utils/parse.c')
-rw-r--r-- | text-utils/parse.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |