Safe Control of Quadruped in Varying Dynamics via Safety Index Adaptation