maple_tree: fix potential out-of-bounds access in mas_wr_end_piv()