Marwan bin al-Hakam and al-Miswar bin Makhramah (may Allah be pleased with them both) narrate regarding the story of Hudaybiyah that Quraysh called Suhayl bin Amr and said: Go to this man (that is, Muhammad (peace and blessings be upon him)) and make peace with him, and let the peace contain nothing but that he goes back from us this year, so that the Arabs do not say that he entered it against us by force. Suhayl bin Amr left them, and when the Messenger of Allah (peace and blessings be upon him) saw him coming, he said: "The people have intended peace, since they have sent this man." When he reached the Messenger of Allah (peace and blessings be upon him), the two of them talked until peace was concluded on these terms: that war would be laid aside between them for ten years; that people would be safe from one another; that he (peace and blessings be upon him) would go back from them that year, and when he came the following year they would leave Makkah open to him and he would stay there for three days; that he would enter it only with a rider's weapons, with the swords in their sheaths; that if any of your Companions comes to us without the permission of his guardian, we will not return him to you, and if any of us goes to you without the permission of his guardian, you will return him; that between us and you there is a closed bag (that is, hearts will be kept clean); and that there will be no stealing and no treachery.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجزية / 18809
Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) says that the truce between the Prophet (peace and blessings be upon him) and the people of Makkah in the year of al-Hudaybiyyah was for 4 years.
Asim bin Umar bin Hafs al-Umari, who narrated it, is very da'if (weak). The preserved (mahfuz) report is the first one; this Asim bin Umar narrates things in which he is not corroborated, and Yahya bin Ma'in, al-Bukhari and other imams declared him weak.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجزية / 18810