From 8e3b39a9e0c2fbc268919a57fb1e3cf7aa2aedf4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 19 Sep 2011 19:57:29 -0500 Subject: pacman: use dynamic string allocation where it makes sense None of these are hot-code paths, and at least the target reading has little need for an arbitrary length limitation (however crazy it might be to have longer arguments). Signed-off-by: Dan McGee --- src/pacman/util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/pacman/util.c') diff --git a/src/pacman/util.c b/src/pacman/util.c index 9e390b2d..05873c99 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -680,8 +680,9 @@ void signature_display(const char *title, alpm_siglist_t *siglist) } else { size_t i; for(i = 0; i < siglist->count; i++) { - char sigline[PATH_MAX]; + char *sigline; const char *status, *validity, *name; + int ret; alpm_sigresult_t *result = siglist->results + i; /* Don't re-indent the first result */ if(i != 0) { @@ -726,10 +727,15 @@ void signature_display(const char *title, alpm_siglist_t *siglist) break; } name = result->key.uid ? result->key.uid : result->key.fingerprint; - snprintf(sigline, PATH_MAX, _("%s, %s from \"%s\""), + ret = pm_asprintf(&sigline, _("%s, %s from \"%s\""), status, validity, name); + if(ret < 1) { + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to allocate string\n")); + continue; + } indentprint(sigline, len); printf("\n"); + free(sigline); } } } -- cgit v1.2.3-24-g4f1b