xbps-{bin,repo}: use strlcpy().

This commit is contained in:
Juan RP 2010-12-24 05:31:37 +01:00
parent 45b4fada3d
commit 57453d1926
2 changed files with 4 additions and 4 deletions

View File

@ -33,6 +33,7 @@
#include <unistd.h>
#include <xbps_api.h>
#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);

View File

@ -32,6 +32,7 @@
#include <assert.h>
#include <xbps_api.h>
#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);
}