1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-07 17:47:14 +00:00

Fix non-constant format string in calls to Printf-like functions

In a few places, we call Printf-like functions, but for the format we
use either non-format messages (which is not tidy, but okay), or
variable messages (which can be problematic if they contain %-format
directives).

The patch fixes the calls by either moving to Print-like functions, or
using `Printf("%s", message)` instead.

These were found by a combination of `go vet` (which complains about
"non-constant format string in call"), and manual inspection.
This commit is contained in:
Alberto Bertogli
2025-10-24 12:34:58 +01:00
parent 3776186288
commit 5c2566c9b1
5 changed files with 14 additions and 14 deletions

View File

@@ -378,18 +378,18 @@ func (c *Conn) EHLO(params string) (code int, msg string) {
c.isESMTP = true
buf := bytes.NewBuffer(nil)
fmt.Fprintf(buf, c.hostname+" - Your hour of destiny has come.\n")
fmt.Fprintf(buf, "8BITMIME\n")
fmt.Fprintf(buf, "PIPELINING\n")
fmt.Fprintf(buf, "SMTPUTF8\n")
fmt.Fprintf(buf, "ENHANCEDSTATUSCODES\n")
fmt.Fprint(buf, c.hostname+" - Your hour of destiny has come.\n")
fmt.Fprint(buf, "8BITMIME\n")
fmt.Fprint(buf, "PIPELINING\n")
fmt.Fprint(buf, "SMTPUTF8\n")
fmt.Fprint(buf, "ENHANCEDSTATUSCODES\n")
fmt.Fprintf(buf, "SIZE %d\n", c.maxDataSize)
if c.onTLS {
fmt.Fprintf(buf, "AUTH PLAIN\n")
fmt.Fprint(buf, "AUTH PLAIN\n")
} else {
fmt.Fprintf(buf, "STARTTLS\n")
fmt.Fprint(buf, "STARTTLS\n")
}
fmt.Fprintf(buf, "HELP\n")
fmt.Fprint(buf, "HELP\n")
return 250, buf.String()
}