TLS: Fix X.509 certificate name conversion into empty string

If none of the supported name attributes are present, the name string
was nul terminated only at the end. Add an explicit nul termination at
the end of the last written (or beginning of the buffer, if nothing is
written) to avoid writing uninitialized data to debug log.

Signed-off-by: Jouni Malinen <j@w1.fi>
master
Jouni Malinen 5 years ago
parent 3eae9766b7
commit 62269c8d8d

@ -532,6 +532,8 @@ void x509_name_string(struct x509_name *name, char *buf, size_t len)
}
done:
if (pos < end)
*pos = '\0';
end[-1] = '\0';
}

Loading…
Cancel
Save