common/parser.go: An ASCII string not being terminated with NUL now panics

This likely means an offset error or something else that's very bad. We
shouldn't be forgiving it.
for/master
Dustin Oprea 2020-01-05 17:04:51 -05:00
parent 351f1b7549
commit 9441507683
1 changed files with 2 additions and 4 deletions

View File

@ -50,10 +50,8 @@ func (p *Parser) ParseAscii(data []byte, unitCount uint32) (value string, err er
}
if len(data) == 0 || data[count-1] != 0 {
s := string(data[:count])
typeLogger.Warningf(nil, "ascii not terminated with nul as expected: [%v]", s)
return s, nil
log.Panicf("ascii not terminated with nul as expected")
return "", nil
} else {
// Auto-strip the NUL from the end. It serves no purpose outside of
// encoding semantics.