Harden STARTTLS handlers and add per-dialect tests
Bound line reads with readLineLimited to prevent a peer from exhausting memory by withholding line terminators, wrap previously bare error returns for consistent context, surface XML decoder Skip errors, and replace the goto in the XMPP feature scan with a labeled break. New starttls_test.go exercises SMTP/IMAP/POP3/XMPP/LDAP success and not-advertised paths through net.Pipe-mocked servers.
This commit is contained in:
parent
4177fcdc7b
commit
e32633ca40
6 changed files with 330 additions and 19 deletions
|
|
@ -60,7 +60,7 @@ func readSMTPGreeting(r *bufio.Reader) error {
|
|||
func readSMTPResponse(r *bufio.Reader) ([]string, error) {
|
||||
var out []string
|
||||
for {
|
||||
line, err := r.ReadString('\n')
|
||||
line, err := readLineLimited(r)
|
||||
if err != nil {
|
||||
return out, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue