The Prophet ﷺ said, "A good dream is from Allah, and a bad dream is from Satan. Whoever sees something he dislikes should spit lightly to his left three times and seek refuge from Satan, and it will not harm him. Indeed, Satan cannot take my form."
قال النبي ﷺ: الرؤيا الصالحة من الله والحلم من الشيطان، فمن رأى شيئا يكرهه فلينفث عن شماله ثلاثا وليتعوذ من الشيطان فإنها لا تضره، وإن الشيطان لا يتزايا بي.
Bukhari related it in the Book of Dream Interpretation (6995) from Yahya bin Bukayr, who said, Layth narrated to us, from Ubaydullah bin Abu Jafar, Abu Salama informed me, from Abu Qatada, and he mentioned it.Muslim related it in the Book of Dreams (2261:2) via Yahya bin Saeed, from Abu Salama, from him, in similar fashion, but he did not mention, "and indeed Satan cannot take on my appearance."His statement "la yatazaya" is with a zay, followed by an alif and then a ya, as found in the narrations other than that of Abu Dharr. Hafiz said so in Fath al-Bari (12/386), and its meaning is that Satan cannot appear in my guise.In the narration of Abu Dharr, with a plain ra, it reads "la yataraa bi," meaning he cannot manage to become visible in my form.Hafiz said, some commentators gave preference to the narration with the zay over this one. He said, but the other narration is not far removed from this same meaning. Fath al-Bari (12/386).