Abdullah bin Masud reported,

The Prophet of Allah ﷺ led them in the noon prayer and either added to it or fell short. Mansur said, "I do not know whether Ibrahim was uncertain or Alqama."It was said, "Messenger of Allah, has the prayer been shortened, or did you forget?"He replied, "What is that?"They said, "You prayed such and such."So he performed two prostrations with them, then said, "These two prostrations are for whoever does not know whether he added to his prayer or fell short. He should seek out what is correct, complete what remains, and then perform two prostrations."

Bukhari 6671

Sahih

حدثنا إسحاق بن إبراهيم سمع عبد العزيز بن عبد الصمد حدثنا منصور عن إبراهيم عن علقمة

عن ابن مسعود رضي الله عنه

أن نبي الله ﷺ صلى بهم صلاة الظهر فزاد أو نقص منها قال منصور لا أدري إبراهيم وهم أم علقمة قال قيل يا رسول الله أقصرت الصلاة أم نسيت قال وما ذاك قالوا صليت كذا وكذا قال فسجد بهم سجدتين ثم قال هاتان السجدتان لمن لا يدري زاد في صلاته أم نقص فيتحرى الصواب فيتم ما بقي ثم يسجد سجدتين

البخاري 6671صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Oaths and vows
Chapter
If one breaks an oath forgetfully
Numbering
Darussalam 6671
Bukhari 6671