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>
This commit is contained in:
parent
3eae9766b7
commit
62269c8d8d
1 changed files with 2 additions and 0 deletions
|
@ -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…
Reference in a new issue