Your pastor is correct. Canon Law says a person may receive Holy Communion a second time, provided he does so during a celebration of the Eucharist in which he participates (canon 917). The stipulation that one receive the second Communion at a Mass “in which he participates” doesn’t apply in the case of those in danger of death (canon 921).
The confusion about this subject is due to post-conciliar changes in Church practice regarding the Eucharist. In the old 1917 Code of Cannon Law, reception of Holy Communion more than once a day was prohibited. After Vatican II this restriction was mitigated to permit reception twice on the same day. The 1983 revised Code of Canon Law incorporated the post-conciliar change in practice into the law of the Church.