Hadithcore
Bulugh al-Maram, 72

Narrated Talq bin ‘Ali (rad):

A man said: “I touched my penis” or he said, “Does a man who touch his penis during the prayer should perform Wudu (ablution)?” The Prophet (ﷺ) replied, “No, it is only a part of your body”. [Reported by Al-Khamsa. Ibn Hibban graded it Sahih (sound).

وَعَنْ طَلْقِ بْنِ عَلِيٍّ ‏- رضى الله عنه ‏- قَالَ: { قَالَ رَجُلٌ: مَسَسْتُ ذَكَرِي أَوْ قَالَ اَلرَّجُلُ يَمَسُّ ذَكَرَهُ فِي اَلصَّلَاةِ, أَعَلَيْهِ وُضُوءٍ ? فَقَالَ اَلنَّبِيُّ ‏- صلى الله عليه وسلم ‏-"لَا, إِنَّمَا هُوَ بَضْعَةٌ مِنْكَ } أَخْرَجَهُ اَلْخَمْسَةُ, وَصَحَّحَهُ اِبْنُ حِبَّان َ [1]‏ .‏

References2 variants
In-Book Reference
Book 1, Hadith 85
English Reference
Book 1, Hadith 78