diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 34dc4edc90d2..0be5a41571af 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -292,6 +292,7 @@ otherwise no tag is added. {issue}42208[42208] {pull}42403[42403] - Reset EventLog if error EOF is encountered. {pull}42826[42826] - Implement backoff on error retrial. {pull}42826[42826] - Fix boolean key in security pipelines and sync pipelines with integration. {pull}43027[43027] +- Fix EvtVarTypeAnsiString conversion {pull}44026[44026] *Elastic Logging Plugin* diff --git a/winlogbeat/sys/strings_windows.go b/winlogbeat/sys/strings_windows.go index 0ce8b09f5d63..bdfa4c897c68 100644 --- a/winlogbeat/sys/strings_windows.go +++ b/winlogbeat/sys/strings_windows.go @@ -18,6 +18,7 @@ package sys import ( + "bytes" "sync" "golang.org/x/sys/windows" @@ -48,6 +49,8 @@ func initANSIDecoder() *encoding.Decoder { } func ANSIBytesToString(enc []byte) (string, error) { - out, err := getCachedANSIDecoder().Bytes(enc) + // Trim to the null terminator + prefix, _, _ := bytes.Cut(enc, []byte("\x00")) + out, err := getCachedANSIDecoder().Bytes(prefix) return string(out), err }