core: Initialize g_buf dynamically, add MES_STRING_MAX override.