RMR params payload points to params msgbuf. Make sure that freed memory is not used
[ric-plt/submgr.git] / pkg / teststub / controlRmrStub.go
index 0f207e8..958b8b8 100644 (file)
@@ -88,6 +88,10 @@ func (tc *RmrStubControl) Consume(params *xapp.RMRParams) (err error) {
        msg := xapptweaks.NewParams(params)
        tc.CntRecvMsg++
 
+       cPay := append(msg.Payload[:0:0], msg.Payload...)
+       msg.Payload = cPay
+       msg.PayloadLen = len(cPay)
+
        if msg.Mtype == tc.InitMsg {
                tc.Logger.Info("Testing message ignore %s", msg.String())
                tc.SetActive()