FR 5712 then FR 6608 at Madrid
Budapest → Madrid → Rabat
Timetable, Madrid time
19:00FR 5712 from Budapest at the gate
13:40FR 6608 to Rabat leaves the gate
18 h 40 apart on the timetable, overnight
FR 6608 leaves 18 h 40 after FR 5712 arrives on the timetable: more than half a day, so not a connection we count.