Prevent output of escaped null characters dn gets
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
diff --git a/library/x509.c b/library/x509.c
index f574055..42839e8 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -919,7 +919,10 @@
c = name->val.p[i];
// Special characters requiring escaping, RFC 4514 Section 2.4
- if (c) {
+ if (c == '\0') {
+ return MBEDTLS_ERR_X509_INVALID_NAME;
+ }
+ else {
if (strchr(",=+<>;\"\\", c) ||
((i == 0) && strchr("# ", c)) ||
((i == name->val.len-1) && (c == ' '))) {