Fix memory corruption in ExecCmd

Change-Id: Id11fe46dc9ec96ca3d944be2b20d6bc670f8b0ac