Skip to content

Commit 9dd9148

Browse files
tsgandrewkroh
authored andcommitted
Fix missing length check in PgSQL (elastic#5457) (elastic#5480)
There was a length check missing. (cherry picked from commit aeca657)
1 parent 13070d4 commit 9dd9148

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ https://github.com/elastic/beats/compare/v5.6.3...5.6[Check the HEAD diff]
3838

3939
*Packetbeat*
4040

41+
- Fix missing length check in the PostgreSQL module. {pull}5457[5457]
42+
4143
*Winlogbeat*
4244

4345
==== Added

packetbeat/protos/pgsql/parse.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ func pgsqlFieldsParser(s *pgsqlStream, buf []byte) error {
379379
off += 4
380380

381381
// read format (int16)
382+
if len(buf) < off+2 {
383+
return errFieldBufferShort
384+
}
382385
format := common.BytesNtohs(buf[off : off+2])
383386
off += 2
384387
fieldsFormat = append(fieldsFormat, byte(format))

0 commit comments

Comments
 (0)