Here's some part numbers for the shock shafts. The shaft is the important one, as its where the difference in length comes from.
MX250B:
509-22481-01
YZ250B:
509-22481-01
YZ125C:
509-22481-01
YZ250C:
509-22481-02
YZ125X:
509-22481-02
So yes, they're all 509 part numbers, but they're not all the same.