xbps-{bin,repo}: fixed crash in 'show' target reported by pancake.
(cherry picked from commit 4129a08cef7139b30b41ac659f35f9d494c2d918)
This commit is contained in:
parent
b08d3ea89c
commit
83688cf8ec
@ -127,11 +127,12 @@ show_pkg_namedesc(struct xbps_handle *xhp,
|
|||||||
|
|
||||||
len = strlen(inststr) + strlen(tmp) + strlen(desc) + 1;
|
len = strlen(inststr) + strlen(tmp) + strlen(desc) + 1;
|
||||||
if (len > rsd->maxcols) {
|
if (len > rsd->maxcols) {
|
||||||
out = malloc(rsd->maxcols);
|
out = malloc(rsd->maxcols+1);
|
||||||
assert(out);
|
assert(out);
|
||||||
snprintf(out, rsd->maxcols-2, "%s %s %s",
|
snprintf(out, rsd->maxcols-3, "%s %s %s",
|
||||||
inststr, tmp, desc);
|
inststr, tmp, desc);
|
||||||
strncat(out, "...", rsd->maxcols);
|
strncat(out, "...", rsd->maxcols);
|
||||||
|
out[rsd->maxcols+1] = '\0';
|
||||||
printf("%s\n", out);
|
printf("%s\n", out);
|
||||||
free(out);
|
free(out);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user