Add check for maximal name length to name_new.

Fail name_new if the provided name is longer than the maximum allowed
length of a name.