Leinart, who has spent the last three seasons as a backup with the Houston Texans and Oakland Raiders, will take over behind center after injuries to quarterbacks E.J. Manuel and Kevin Kolb.
Manuel, whom the Bills took with the 16th overall pick in this year's draft, is recuperating from minor surgery on his left knee and is out for the pre-season.
Kolb sustained a concussion in Saturday's loss to the Washington Redskins.
Leinart has compiled 4,065 yards, 15 touchdowns and 21 interceptions over 33 career games for the Arizona Cardinals, Texans and Raiders.
Video of Victoria’s Secret models trying to 'twerk' hits Instagram
Exploding whale video goes viral on Internet