]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sasl: fuzz-sasl-authentication - Limit the length of the passwords
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 3 Nov 2025 17:12:17 +0000 (18:12 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 4 Nov 2025 00:37:13 +0000 (01:37 +0100)
For hashed algorithms, the password length could rise limitless, causing
fuzzer timeouts.

OSS-Fuzz report: 457240545

src/lib-sasl/fuzz-sasl-authentication.c

index 604e35e84ebee42ccd333b8a586ce8aedc79bda7..8c377c124250564365b19a805b9bea132e9f94b0 100644 (file)
@@ -20,6 +20,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#define FUZZ_SASL_MAX_PASSWORD_SIZE SASL_MAX_MESSAGE_SIZE
+
 enum fuzz_sasl_modification {
        FUZZ_SASL_MOD_DELETE = 0,
        FUZZ_SASL_MOD_REPLACE,
@@ -595,11 +597,15 @@ static void fuzz_sasl_run(struct istream *input)
        line = i_stream_read_next_line(input);
        if (line == NULL)
                return;
+       if (strlen(line) > FUZZ_SASL_MAX_PASSWORD_SIZE)
+               return;
        params.server_password = t_strdup(line);
 
        line = i_stream_read_next_line(input);
        if (line == NULL)
                return;
+       if (strlen(line) > FUZZ_SASL_MAX_PASSWORD_SIZE)
+               return;
        if (*line == '\0')
                params.client_password = params.server_password;
        else