Language:
كتاب الأيمان والنذور
83  
Oaths and Vows
(15)
Chapter: If someone does something against his oath due to forgetfulness
(15)
بَابُ إِذَا حَنِثَ نَاسِيًا فِي الأَيْمَانِ
Sahih al-Bukhari 6671

Narrated Ibn Mas`ud:

that Allah's Prophet led them in the Zuhr prayer and he offered either more or less rak`at, and it was said to him, "O Allah's Messenger (ﷺ) ! Has the prayer been reduced, or have you forgotten?" He asked, "What is that?" They said, "You have prayed so many rak`at." So he performed with them two more prostrations and said, "These two prostrations are to be performed by the person who does not know whether he has prayed more or less (rak`at) in which case he should seek to follow what is right. And then complete the rest (of the prayer) and perform two extra prostrations."

حَدَّثَنِي إِسْحَاقُ بْنُ إِبْرَاهِيمَ، سَمِعَ عَبْدَ الْعَزِيزِ بْنَ عَبْدِ الصَّمَدِ، حَدَّثَنَا مَنْصُورٌ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، عَنِ ابْنِ مَسْعُودٍ ـ رضى الله عنه أَنَّ نَبِيَّ اللَّهِ صلى الله عليه وسلم صَلَّى بِهِمْ صَلاَةَ الظُّهْرِ، فَزَادَ أَوْ نَقَصَ مِنْهَا ـ قَالَ مَنْصُورٌ لاَ أَدْرِي إِبْرَاهِيمُ وَهِمَ أَمْ عَلْقَمَةُ ـ قَالَ قِيلَ يَا رَسُولَ اللَّهِ أَقَصُرَتِ الصَّلاَةُ أَمْ نَسِيتَ قَالَ ‏"‏ وَمَا ذَاكَ ‏"‏‏.‏ قَالُوا صَلَّيْتَ كَذَا وَكَذَا‏.‏ قَالَ فَسَجَدَ بِهِمْ سَجْدَتَيْنِ ثُمَّ قَالَ ‏"‏ هَاتَانِ السَّجْدَتَانِ لِمَنْ لاَ يَدْرِي، زَادَ فِي صَلاَتِهِ أَمْ نَقَصَ، فَيَتَحَرَّى الصَّوَابَ، فَيُتِمُّ مَا بَقِيَ، ثُمَّ يَسْجُدُ سَجْدَتَيْنِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6671
In-book reference : Book 83, Hadith 49
USC-MSA web (English) reference : Vol. 8, Book 78, Hadith 664
  (deprecated numbering scheme)