The Messenger of Allah ﷺ said, "The two parties to a sale each have the option to back out as long as they have not parted, except in a sale where the option has been stipulated."
أخبرنا محمد بن سلمة والحارث بن مسكين قراءة عليه وأنا أسمع واللفظ له عن ابن القاسم قال حدثني مالك عن نافع
أن رسول الله ﷺ قال المتبايعان كل واحد منهما بالخيار على صاحبه ما لم يفترقا إلا بيع الخيار
Reported by Bukhari, Sales, chapter on the two parties to a sale having the option [to cancel] as long as they have not parted, hadith no. 2111, and Muslim, Sales, chapter on the establishment of the option of session for the two parties to a sale, hadith no. 1531, from the hadith of Malik through this same chain. It is also found in Muwatta (Yahya): 2/671, and in Kubra, hadith no. 6057.