عَن سَعْدِ بْنِ أَبِي وَقَّاصٍ قَالَ: عَادَنِي رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَأَنَا مَرِيضٌ فَقَالَ: «أَوْصَيْتَ؟» قُلْتُ: نَعَمْ قَالَ: «بِكَمْ؟» قُلْتُ: بِمَالِي كُلِّهِ فِي سَبِيلِ اللَّهِ. قَالَ: «فَمَا تَرَكْتَ لِوَلَدِكَ؟» قُلْتُ: هُمْ أَغْنِيَاءُ بِخَيْرٍ. فَقَالَ: «أوص بالعشر» فَمَا زَالَت أُنَاقِصُهُ حَتَّى قَالَ: «أَوْصِ بِالثُّلُثِ وَالثُّلُثُ كَثِيرٌ» . رَوَاهُ التِّرْمِذِيّ
Translation
Abu Umama told of hearing God’s Messenger say in his sermon in the year of the Farewell Pilgrimage, “God has appointed for everyone who has a right what is due to him, and no legacy must be made to an heir.” Abu Dawud and Ibn Majah transmitted it.Tirmidhi added

“The child is attributed to the mother’s husband, but the adulterer gets nothing, and their reckoning is in God’s hands.”