core: Fix a possible buffer overflow using getself_name().

If the passed buffer is smaller than MAX_NAME_LENGTH then, you
will probably overflow it.