If the ends will mate back together with no gaps then the simplest repair is a couple of dowels and some wood glue. Otherwise a scarf joint.
Work out the greatest diameter of dowel you can fit 2 of into the cross-section of the upright, leaving sufficient material all around the dowels. Clamp one of the workpieces to something steady to keep it still. Cut 2 lengths of dowel about 5cm, hold them in position on one of the ends and mark either side of each dowel with a pencil. Tap a small pin into the centre of each position and trim down to a few mm so you can grip them with pliers later. Offer up the other broken end and align them together. Tap on the top with a rubber mallet so the pins leave a mark. Remove the pins. Drill a hole for the dowels centred on each pin mark, erring towards too small. Dry fit the dowels and test the fit. If too tight, drill again slightly larger. Once the ends will go together, apply glue to the break, dowels, and hole surfaces, and push it all together.