كتاب البر والصلة والآداب
45  
The Book of Virtue, Enjoining Good Manners, and Joining of the Ties of Kinship
(25)
Chapter: Whomever Is Cursed, Reviled Or Prayed Against By The Prophet (SAW) When He Does Not Deserve That, It Will Be Purification, Reward And Mercy For Him
(25)
باب مَنْ لَعَنَهُ النَّبِيُّ صلى الله عليه وسلم أَوْ سَبَّهُ أَوْ دَعَا عَلَيْهِ
Sahih Muslim 2601 a

Abu Huraira reported Allah's Messenger (ﷺ) as saying:

O Allah, I am a human being and for any person amongst Muslims upon whom I hurl malediction or invoke curse or give him whipping make it a source of purity and mercy.
حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ نُمَيْرٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا الأَعْمَشُ، عَنْ أَبِي صَالِحٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ اللَّهُمَّ إِنَّمَا أَنَا بَشَرٌ فَأَيُّمَا رَجُلٍ مِنَ الْمُسْلِمِينَ سَبَبْتُهُ أَوْ لَعَنْتُهُ أَوْ جَلَدْتُهُ فَاجْعَلْهَا لَهُ زَكَاةً وَرَحْمَةً ‏"‏ ‏.‏
Reference : Sahih Muslim 2601a
In-book reference : Book 45, Hadith 114
USC-MSA web (English) reference : Book 32, Hadith 6287
  (deprecated numbering scheme)