xbps-git: backport a patch from single-pkgdb branch to fix crash in search target.

This commit is contained in:
Juan RP 2012-09-19 12:02:42 +02:00
parent 8b98c7a79e
commit 22e890262d
2 changed files with 26 additions and 1 deletions

View file

@ -0,0 +1,25 @@
commit 4129a08cef7139b30b41ac659f35f9d494c2d918
Author: Juan RP <xtraeme@gmail.com>
Date: Wed Sep 19 07:04:59 2012 +0200
xbps-{bin,repo}: fixed crash in 'show' target reported by pancake.
diff --git a/bin/xbps-repo/show.c b/bin/xbps-repo/show.c
index 170b1bd..f8265de 100644
--- bin/xbps-repo/show.c
+++ bin/xbps-repo/show.c
@@ -127,11 +127,12 @@ show_pkg_namedesc(struct xbps_handle *xhp,
len = strlen(inststr) + strlen(tmp) + strlen(desc) + 1;
if (len > rsd->maxcols) {
- out = malloc(rsd->maxcols);
+ out = malloc(rsd->maxcols+1);
assert(out);
- snprintf(out, rsd->maxcols-2, "%s %s %s",
+ snprintf(out, rsd->maxcols-3, "%s %s %s",
inststr, tmp, desc);
strncat(out, "...", rsd->maxcols);
+ out[rsd->maxcols+1] = '\0';
printf("%s\n", out);
free(out);
} else {

View file

@ -1,7 +1,7 @@
# Template file for 'xbps-git'
pkgname=xbps-git
version="$(date -u +%Y%m%d)"
revision=1
revision=2
nofetch=yes
noextract=yes
build_style=configure