Hard to say just by reading those two lines of code. What is 'serial'? What is 'write'?

I am going to take a shot in the dark here: does, by any chance, the method WhateverClassSerialIsAnInstanceOf::write(const char *s) write to the serial port the bytes starting at s, up to and including the first NUL byte? If it is so, then your code only writes the 5 first bytes of panID.