]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_debug: Remove 2048 byte message length limit
authorAnders Kaseorg <andersk@MIT.EDU>
Sun, 16 Feb 2014 00:08:32 +0000 (19:08 -0500)
committerJouni Malinen <j@w1.fi>
Thu, 20 Feb 2014 14:32:26 +0000 (16:32 +0200)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
src/utils/wpa_debug.c

index 7846c1e5f2e5d5c03cddc8cf31bb5be22ec28c60..647f6b4be72d0004c484ba38fb942d30c4cf8ada 100644 (file)
@@ -596,10 +596,14 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...)
 {
        va_list ap;
        char *buf;
-       const int buflen = 2048;
+       int buflen;
        int len;
        char prefix[130];
 
+       va_start(ap, fmt);
+       buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+       va_end(ap);
+
        buf = os_malloc(buflen);
        if (buf == NULL) {
                wpa_printf(MSG_ERROR, "wpa_msg: Failed to allocate message "
@@ -630,12 +634,16 @@ void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
 {
        va_list ap;
        char *buf;
-       const int buflen = 2048;
+       int buflen;
        int len;
 
        if (!wpa_msg_cb)
                return;
 
+       va_start(ap, fmt);
+       buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+       va_end(ap);
+
        buf = os_malloc(buflen);
        if (buf == NULL) {
                wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate "
@@ -654,9 +662,13 @@ void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
 {
        va_list ap;
        char *buf;
-       const int buflen = 2048;
+       int buflen;
        int len;
 
+       va_start(ap, fmt);
+       buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+       va_end(ap);
+
        buf = os_malloc(buflen);
        if (buf == NULL) {
                wpa_printf(MSG_ERROR, "wpa_msg_global: Failed to allocate "
@@ -677,9 +689,13 @@ void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
 {
        va_list ap;
        char *buf;
-       const int buflen = 2048;
+       int buflen;
        int len;
 
+       va_start(ap, fmt);
+       buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+       va_end(ap);
+
        buf = os_malloc(buflen);
        if (buf == NULL) {
                wpa_printf(MSG_ERROR, "wpa_msg_no_global: Failed to allocate "
@@ -712,9 +728,13 @@ void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level,
 {
        va_list ap;
        char *buf;
-       const int buflen = 2048;
+       int buflen;
        int len;
 
+       va_start(ap, fmt);
+       buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+       va_end(ap);
+
        buf = os_malloc(buflen);
        if (buf == NULL) {
                wpa_printf(MSG_ERROR, "hostapd_logger: Failed to allocate "