Merge pull request #3289 from hgarrereyn/master

fix wrong call and undefined use of va_args in mg_queue_vprintf
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2025-09-29 14:08:57 -03:00
commit 01902bb8b9
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