]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow "%.*s" for strings
authorAlan T. DeKok <aland@freeradius.org>
Tue, 19 Feb 2019 23:06:08 +0000 (18:06 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 19 Feb 2019 23:06:08 +0000 (18:06 -0500)
so we don't crash when using them.

src/lib/util/print.c

index a8b80883e2081de2ed924564c35f0810c7d066b6..e587e1da406f5f42fc25e31836427b1eb10d40b7 100644 (file)
@@ -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 {