Recent years have seen rising needs for location-based services in our everyday life. Aside from the many advantages provided by these services, they have caused serious concerns regarding the location privacy of users. Adversaries can monitor the queried locations by users to infer sensitive information, such as home addresses and shopping habits. To address this issue, dummy-based algorithms have been developed to increase the anonymity of users, and thus, protecting their privacy. Unfortunately, the existing algorithms only assume a limited amount of side information known by adversaries, which may face more severe challenges in practice. In this paper, we develop an attack model termed as Viterbi attack, which represents a realistic privacy threat on user trajectories. Moreover, we propose a metric called transition entropy that enables the evaluation of dummy-based algorithms, followed by developing a robust algorithm that can defend users against the Viterbi attack while maintaining significantly high performance in terms of the traditional metrics. We compare and evaluate our proposed algorithm and metric on a publicly available dataset published by Microsoft, i.e., Geolife dataset.