كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(19)
Chapter: As-Sahw (forgetfulness) in prayer and prostrating to compensate for it
(19)
باب السَّهْوِ فِي الصَّلاَةِ وَالسُّجُودِ لَهُ ‏
Sahih Muslim 573 d

Abu Huraira reported:

The Messenger of Allah (ﷺ) said two rak'ahs of the noon prayer and then gave salutation when a man from Band Sulaim came to him and said: Messenger of Allah. has the prayer been shortened, or have you forgotten? -and the rest of the hadith is the same.
وَحَدَّثَنِي حَجَّاجُ بْنُ الشَّاعِرِ، حَدَّثَنَا هَارُونُ بْنُ إِسْمَاعِيلَ الْخَزَّازُ، حَدَّثَنَا عَلِيٌّ، - وَهُوَ ابْنُ الْمُبَارَكِ - حَدَّثَنَا يَحْيَى، حَدَّثَنَا أَبُو سَلَمَةَ، حَدَّثَنَا أَبُو هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم صَلَّى رَكْعَتَيْنِ مِنْ صَلاَةِ الظُّهْرِ ثُمَّ سَلَّمَ فَأَتَاهُ رَجُلٌ مِنْ بَنِي سُلَيْمٍ فَقَالَ يَا رَسُولَ اللَّهِ أَقُصِرَتِ الصَّلاَةُ أَمْ نَسِيتَ وَسَاقَ الْحَدِيثَ ‏.‏
Reference : Sahih Muslim 573d
In-book reference : Book 5, Hadith 129
USC-MSA web (English) reference : Book 4, Hadith 1185
  (deprecated numbering scheme)