Skip to content

Commit fce882d

Browse files
committed
make overflow fix more flexible
1 parent eb1096b commit fce882d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/journald/journald.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package journald
33
import (
44
"errors"
55
"fmt"
6+
"math"
67
"sync/atomic"
78
"syscall"
89
)
@@ -32,7 +33,6 @@ const (
3233
// journald entries.
3334
SchemaVersion = "1"
3435
defaultIdentifier = "knocker"
35-
maxFieldsCount = 1024
3636
)
3737

3838
// Enabled reports whether structured journald logging is available on the
@@ -51,8 +51,8 @@ func Emit(eventType, message string, priority Priority, fields Fields) error {
5151
return nil
5252
}
5353

54-
if len(fields) > maxFieldsCount {
55-
return fmt.Errorf("too many fields in journald entry: %d > %d", len(fields), maxFieldsCount)
54+
if len(fields) > math.MaxInt-3 {
55+
return fmt.Errorf("too many fields in journald entry: %d > %d", len(fields), math.MaxInt-3)
5656
}
5757

5858
payload := make(Fields, len(fields)+3)

0 commit comments

Comments
 (0)