File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,10 @@ func (s *event) SetTimeZone(b []byte) {
137137
138138// SetMonthNumeric sets the month with a number.
139139func (s * event ) SetMonthNumeric (b []byte ) {
140- s .month = monthIndexed [bytesToInt (skipLeadZero (b ))]
140+ month := bytesToInt (skipLeadZero (b ))
141+ if month <= 12 {
142+ s .month = monthIndexed [month ]
143+ }
141144}
142145
143146// SetMonth sets the month.
@@ -211,6 +214,9 @@ func (s *event) Year() int {
211214
212215// SetMessage sets the message.
213216func (s * event ) SetMessage (b []byte ) {
217+ if len (b ) < 3 {
218+ return
219+ }
214220 // remove BOM
215221 if b [0 ] == 0xef && b [1 ] == 0xbb && b [2 ] == 0xbf {
216222 s .message = string (b [3 :])
Original file line number Diff line number Diff line change @@ -796,6 +796,16 @@ func TestPriority(t *testing.T) {
796796 }
797797}
798798
799+ func TestParserRFC3164InvalidMonthNumeric (t * testing.T ) {
800+ event := newEvent ()
801+ ParserRFC3164 ([]byte ("0000-20-" ), event )
802+ }
803+
804+ func TestParserRFC3164ShortMessage (t * testing.T ) {
805+ event := newEvent ()
806+ ParserRFC3164 ([]byte ("Oct 1 00:00:00 \xef " ), event )
807+ }
808+
799809var e * event
800810
801811func BenchmarkParserRFC3164r (b * testing.B ) {
You can’t perform that action at this time.
0 commit comments