Long enough to be below the top of the center rail, but short enough to clear the surface of the track by about an 1/8" of an inch or so. The replacement peg is mostly used as a safety catch in case a three wheel car steers the wrong way and into the other lanes or off the edge of the track.
Obviously, the peg should be long enough that it catches the inside rail. The question might be... what type of peg should I use? There are many types that guys use... plastic fin or a metal pin. I am not sure which is better. Both are used with good success by some of the top builders.