The Prophet ﷺ said, "The child belongs to the bed, and for the fornicator is the stone."
أخبرنا إسحق بن إبراهيم عن عبد الرزاق قال حدثنا معمر عن الزهري عن سعيد وأبي سلمة
أن النبي ﷺ قال الولد للفراش وللعاهر الحجر
Muslim narrated it from the hadith of Abdul-Razzaq through this route (see the previous hadith), and it is in Kubra, h: 5677.