From: Alan T. DeKok Date: Tue, 19 Feb 2019 23:06:08 +0000 (-0500) Subject: allow "%.*s" for strings X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24a318ca7fa9def7771f2d7973fd959ddcbc35bf;p=thirdparty%2Ffreeradius-server.git allow "%.*s" for strings so we don't crash when using them. --- diff --git a/src/lib/util/print.c b/src/lib/util/print.c index a8b80883e20..e587e1da406 100644 --- a/src/lib/util/print.c +++ b/src/lib/util/print.c @@ -518,9 +518,13 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap) done_flags: /* - * Check for width field + * Check for width field. First for strings, and + * then for other parameters. */ - if (*p == '*') { + if ((*p == '.') && (*(p + 1) == '*') && (*(p + 2) == 's')) { + (void) va_arg(ap_q, int); + p += 2; + } else if (*p == '*') { (void) va_arg(ap_q, int); p++; } else {