xbps-{bin,repo}: strlcpy -> memcpy.
This commit is contained in:
parent
a2e42f1d57
commit
3e93d235ff
@ -28,9 +28,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "compat.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
list_pkgs_in_dict(struct xbps_handle *xhp,
|
list_pkgs_in_dict(struct xbps_handle *xhp,
|
||||||
@ -72,13 +72,12 @@ list_pkgs_in_dict(struct xbps_handle *xhp,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
tmp = calloc(1, lpc->pkgver_len + 1);
|
tmp = calloc(1, lpc->pkgver_len + 1);
|
||||||
if (tmp == NULL)
|
assert(tmp);
|
||||||
return errno;
|
memcpy(tmp, pkgver, lpc->pkgver_len);
|
||||||
|
|
||||||
strlcpy(tmp, pkgver, lpc->pkgver_len + 1);
|
|
||||||
for (i = strlen(tmp); i < lpc->pkgver_len; i++)
|
for (i = strlen(tmp); i < lpc->pkgver_len; i++)
|
||||||
tmp[i] = ' ';
|
tmp[i] = ' ';
|
||||||
|
|
||||||
|
tmp[i] = '\0';
|
||||||
printf("%s %s\n", tmp, short_desc);
|
printf("%s %s\n", tmp, short_desc);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
|
@ -122,13 +122,12 @@ show_pkg_namedesc(struct xbps_handle *xhp,
|
|||||||
(strcasestr(pkgver, rsd->patterns[i])) ||
|
(strcasestr(pkgver, rsd->patterns[i])) ||
|
||||||
(strcasestr(desc, rsd->patterns[i]))) {
|
(strcasestr(desc, rsd->patterns[i]))) {
|
||||||
tmp = calloc(1, rsd->pkgver_len + 1);
|
tmp = calloc(1, rsd->pkgver_len + 1);
|
||||||
if (tmp == NULL)
|
assert(tmp);
|
||||||
return errno;
|
memcpy(tmp, pkgver, rsd->pkgver_len);
|
||||||
|
|
||||||
strlcpy(tmp, pkgver, rsd->pkgver_len + 1);
|
|
||||||
for (x = strlen(tmp); x < rsd->pkgver_len; x++)
|
for (x = strlen(tmp); x < rsd->pkgver_len; x++)
|
||||||
tmp[x] = ' ';
|
tmp[x] = ' ';
|
||||||
|
|
||||||
|
tmp[x] = '\0';
|
||||||
printf(" %s %s\n", tmp, desc);
|
printf(" %s %s\n", tmp, desc);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user