Browse Source

fix slice bound error

Jordan Schalm 8 years ago
parent
commit
2a12a2845e
2 changed files with 4 additions and 1 deletions
  1. 3 0
      dashboard/datastore.go
  2. 1 1
      server.go

+ 3 - 0
dashboard/datastore.go

@@ -256,6 +256,9 @@ func (h logHook) Fire(e *log.Entry) error {
 		if !ok {
 			return nil
 		}
+		if len(helo) > 16 {
+			helo = helo[:16]
+		}
 		ip, ok = e.Data["address"].(string)
 		if !ok {
 			return nil

+ 1 - 1
server.go

@@ -405,7 +405,7 @@ func (server *server) handleClient(client *client) {
 				} else {
 					server.log.WithFields(map[string]interface{}{
 						"event":   "mailfrom",
-						"helo":    client.Helo[:16],
+						"helo":    client.Helo,
 						"domain":  from.Host,
 						"address": client.RemoteAddress,
 						"id":      client.ID,