diff --git a/bin/xbps-bin/list.c b/bin/xbps-bin/list.c index e0f1c4eb..71f67a05 100644 --- a/bin/xbps-bin/list.c +++ b/bin/xbps-bin/list.c @@ -28,9 +28,9 @@ #include #include #include +#include #include "defs.h" -#include "compat.h" int list_pkgs_in_dict(struct xbps_handle *xhp, @@ -72,13 +72,12 @@ list_pkgs_in_dict(struct xbps_handle *xhp, return EINVAL; tmp = calloc(1, lpc->pkgver_len + 1); - if (tmp == NULL) - return errno; - - strlcpy(tmp, pkgver, lpc->pkgver_len + 1); + assert(tmp); + memcpy(tmp, pkgver, lpc->pkgver_len); for (i = strlen(tmp); i < lpc->pkgver_len; i++) tmp[i] = ' '; + tmp[i] = '\0'; printf("%s %s\n", tmp, short_desc); free(tmp); diff --git a/bin/xbps-repo/show.c b/bin/xbps-repo/show.c index bbd7518e..2c5dfcaf 100644 --- a/bin/xbps-repo/show.c +++ b/bin/xbps-repo/show.c @@ -122,13 +122,12 @@ show_pkg_namedesc(struct xbps_handle *xhp, (strcasestr(pkgver, rsd->patterns[i])) || (strcasestr(desc, rsd->patterns[i]))) { tmp = calloc(1, rsd->pkgver_len + 1); - if (tmp == NULL) - return errno; - - strlcpy(tmp, pkgver, rsd->pkgver_len + 1); + assert(tmp); + memcpy(tmp, pkgver, rsd->pkgver_len); for (x = strlen(tmp); x < rsd->pkgver_len; x++) tmp[x] = ' '; + tmp[x] = '\0'; printf(" %s %s\n", tmp, desc); free(tmp); }