srvmgr: Fix issue with memcopy
authorSam Nelson <sam.nelson@ti.com>
Mon, 28 Oct 2019 21:30:03 +0000 (17:30 -0400)
committerSam Nelson <sam.nelson@ti.com>
Mon, 28 Oct 2019 21:43:08 +0000 (17:43 -0400)
Previous fix to avoid the partial copy was wrong. Need to copy only the
task parameters after arg0.

Signed-off-by: Sam Nelson <sam.nelson@ti.com>
packages/ti/srvmgr/ServiceMgr.c

index 08f2de9cd2e124177bf7fb3a5c1af560a1754a9c..bf193abac4407df80e69cbfbe2990cd817c1c583 100644 (file)
@@ -151,8 +151,8 @@ Bool ServiceMgr_registerSrvTask(UInt16 reserved, Task_FuncPtr func,
             /* Deal with the Task_Params to avoid IInstance mismatch */
             params = &st->params;
             Task_Params_init(params);
-            memcpy((Void *)(params), taskParams,
-                        sizeof(*params));
+            memcpy((Void *)(&params->arg0), &taskParams->arg0,
+                        sizeof(*params) - ((UArg)&taskParams->arg0-(UArg)taskParams));
             params->instance->name = st->name;
 
             st->reserved = reserved;