diff --git a/stream/mts/psi/helpers.go b/stream/mts/psi/helpers.go index 86e6cc72..82d7ce72 100644 --- a/stream/mts/psi/helpers.go +++ b/stream/mts/psi/helpers.go @@ -106,14 +106,11 @@ func UpdateLocation(d []byte, s string) error { if !HasLocation(d) { return errors.New("pmt does not location descriptor, cannot update") } - sb := []byte(s) - locBytes := d[LocationDataIndx : LocationDataIndx+LocationDataSize] - for i, _ := range locBytes { - if i < len(sb) { - locBytes[i] = sb[i] - } else { - locBytes[i] = 0x00 - } + loc := d[LocationDataIndx : LocationDataIndx+LocationDataSize] + n := copy(loc, s) + loc = loc[n:] + for i := range loc { + loc[i] = 0 } updateCrc(d) return nil