peroxide: Fix parsing of recursive multipart messages

Make sure to not mix up parent and child part boundary markers when the
clild marker is a suffix of the parent marker.
create-reload-action
Lukasz Janyst 4 years ago
parent b33652344e
commit f79a42ff86
No known key found for this signature in database
GPG Key ID: 32DE641041F17A9A
  1. 2
      pkg/message/scanner.go

@ -86,7 +86,7 @@ func (s *partScanner) readToBoundary() ([]byte, bool, error) {
case bytes.HasPrefix(bytes.TrimSpace(line), []byte("--"+s.boundary)):
return bytes.TrimSuffix(bytes.TrimSuffix(res, []byte("\n")), []byte("\r")), true, nil
case bytes.HasSuffix(bytes.TrimSpace(line), []byte(s.boundary+"--")):
case bytes.Compare(bytes.TrimSpace(line), []byte("--"+s.boundary+"--")) == 0:
return bytes.TrimSuffix(bytes.TrimSuffix(res, []byte("\n")), []byte("\r")), false, nil
default:

Loading…
Cancel
Save