]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Fix logging of uninitialized PONG buffer size
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 27 Nov 2017 09:58:39 +0000 (11:58 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 27 Nov 2017 11:13:39 +0000 (13:13 +0200)
PONG always has 0 or 2 parameters. The easiest fix here is to just not even
try to support 1 parameter.

src/director/director-connection.c

index 327d1495f33ce263c672ed01549d530d75dffcbd..57ba53fa488623110f81fb934fcc6156f20a288f 100644 (file)
@@ -1872,10 +1872,12 @@ static bool director_cmd_pong(struct director_connection *conn,
        conn->ping_waiting = FALSE;
        timeout_remove(&conn->to_pong);
 
-       if (args[0] == NULL || str_to_time(args[0], &sent_time) < 0)
+       if (str_array_length(args) < 2 ||
+           str_to_time(args[0], &sent_time) < 0 ||
+           str_to_uintmax(args[1], &send_buffer_size) < 0) {
                sent_time = 0;
-       else if (args[1] == NULL || str_to_uintmax(args[1], &send_buffer_size) < 0)
                send_buffer_size = (uintmax_t)-1;
+       }
 
        int ping_msecs = timeval_diff_msecs(&ioloop_timeval, &conn->ping_sent_time);
        if (ping_msecs >= 0) {