xbps-{bin,repo}: strlcpy -> memcpy.

This commit is contained in:
Juan RP 2012-06-18 10:42:24 +02:00
parent a2e42f1d57
commit 3e93d235ff
2 changed files with 7 additions and 9 deletions

View File

@ -28,9 +28,9 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#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);

View File

@ -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);
}