]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix edge case with fr_vasprintf
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Mar 2019 11:23:52 +0000 (19:23 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 07:37:45 +0000 (15:37 +0800)
%pV:%u would print the boxed value and a pointer to the box.

src/lib/util/print.c

index e587e1da406f5f42fc25e31836427b1eb10d40b7..5452ffa7dcc43c1d085b3e8fb6c063efef2846ea 100644 (file)
@@ -699,7 +699,6 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
                                        out = out_tmp;
 
                                        va_end(ap_p);           /* one time use only */
-                                       va_copy(ap_p, ap_q);    /* already advanced to the next argument */
                                } else {
                                        out_tmp = talloc_strdup_append_buffer(out, subst);
                                        TALLOC_FREE(subst);
@@ -707,6 +706,8 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
                                        out = out_tmp;
                                }
 
+                               va_copy(ap_p, ap_q);    /* already advanced to the next argument */
+
                                fmt_p = p + 1;
                        }
                                break;