From 57453d192646dab6fe8d9c074399b2273ee2b0ba Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 24 Dec 2010 05:31:37 +0100 Subject: [PATCH] xbps-{bin,repo}: use strlcpy(). --- bin/xbps-bin/main.c | 4 ++-- bin/xbps-repo/util.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index eba530f6..f25ac3ee 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -33,6 +33,7 @@ #include #include +#include "strlcpy.h" #include "defs.h" #include "../xbps-repo/defs.h" @@ -80,11 +81,10 @@ list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done) if (tmp == NULL) return errno; - memcpy(tmp, pkgver, lpc->pkgver_len); + strlcpy(tmp, pkgver, lpc->pkgver_len + 1); for (i = strlen(tmp); i < lpc->pkgver_len; i++) tmp[i] = ' '; - tmp[lpc->pkgver_len + 1] = '\0'; printf("%s %s\n", tmp, short_desc); free(tmp); diff --git a/bin/xbps-repo/util.c b/bin/xbps-repo/util.c index 2a8f0bb9..25966bbc 100644 --- a/bin/xbps-repo/util.c +++ b/bin/xbps-repo/util.c @@ -32,6 +32,7 @@ #include #include +#include "strlcpy.h" #include "defs.h" void @@ -230,11 +231,10 @@ show_pkg_namedesc(prop_object_t obj, void *arg, bool *loop_done) if (tmp == NULL) return errno; - memcpy(tmp, pkgver, rsd->pkgver_len); + strlcpy(tmp, pkgver, rsd->pkgver_len + 1); for (i = strlen(tmp); i < rsd->pkgver_len; i++) tmp[i] = ' '; - tmp[rsd->pkgver_len + 1] = '\0'; printf(" %s %s\n", tmp, desc); free(tmp); }