Don't use a fixed buffer for X509_NAME_oneline() in the client. Do as the server does - allocate it dynamically. For a test - regenerate certificates to have the server cert with a long subject.
added a script to regenerate certificates easily in the future (2035!) restored server8k-key.pem to actually be 8K key, as it was supposed to