fix use of va_args in mg_queue_vprintf, fixes #3285

This commit is contained in:
hgarrereyn committed 2025-09-26 14:28:10 -04:00
1 parent acd65f2340
commit 587e79dc05
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -7812,7 +7812,9 @@ bool mg_ota_end(void) {
size_t mg_queue_vprintf(struct mg_queue *q, const char *fmt, va_list *ap) {
size_t len = mg_snprintf(NULL, 0, fmt, ap);
va_list ap_copy;
va_copy(ap_copy, *ap);
size_t len = mg_vsnprintf(NULL, 0, fmt, &ap_copy);
char *buf;
if (len == 0 || mg_queue_book(q, &buf, len + 1) < len + 1) {
len = 0; // Nah. Not enough space
+3 -1
View File
@@ -3,7 +3,9 @@
#include "util.h"
size_t mg_queue_vprintf(struct mg_queue *q, const char *fmt, va_list *ap) {
size_t len = mg_snprintf(NULL, 0, fmt, ap);
va_list ap_copy;
va_copy(ap_copy, *ap);
size_t len = mg_vsnprintf(NULL, 0, fmt, &ap_copy);
char *buf;
if (len == 0 || mg_queue_book(q, &buf, len + 1) < len + 1) {
len = 0; // Nah. Not enough space