Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 7679132e authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #6832 from thundernest/fix_SmtpResponseParser_bug

Fix SmtpLogger call to not include input in format string
parents 3fc0110b 989c04f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ internal class SmtpResponseParser(

            keywords[keyword] = parameters
        } catch (e: SmtpResponseParserException) {
            logger.log(e, "Ignoring EHLO keyword line: $ehloLine")
            logger.log(e, "Ignoring EHLO keyword line: %s", ehloLine)
        }
    }

+3 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ class SmtpResponseParserTest {
            250-PIPELINING
            250-PIPE_CONNECT
            250-AUTH=PLAIN
            250-%1 crash when included in format string
            250 HELP
        """.toPeekableInputStream()
        val parser = SmtpResponseParser(logger, input)
@@ -195,10 +196,12 @@ class SmtpResponseParserTest {
        assertThat(logger.logEntries.map { it.message }).containsExactly(
            "Ignoring EHLO keyword line: PIPE_CONNECT",
            "Ignoring EHLO keyword line: AUTH=PLAIN",
            "Ignoring EHLO keyword line: %1 crash when included in format string",
        )
        assertThat(logger.logEntries.map { it.throwable?.message }).containsExactly(
            "EHLO keyword contains invalid character",
            "EHLO keyword contains invalid character",
            "EHLO keyword contains invalid character",
        )
    }