Fix bug with checking max dn length with hexpairs
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
diff --git a/library/x509_create.c b/library/x509_create.c
index 6ef33b0..cb9fd69 100644
--- a/library/x509_create.c
+++ b/library/x509_create.c
@@ -168,13 +168,16 @@
}
*(d++) = n;
c++;
- continue;
- } else if (c == end || !strchr(" ,=+<>#;\"\\", *c)) {
+ } else if (c < end && strchr(" ,=+<>#;\"\\", *c)) {
+ *(d++) = *c;
+ } else {
return MBEDTLS_ERR_X509_INVALID_NAME;
}
}
+ else {
+ *(d++) = *c;
+ }
- *(d++) = *c;
if (d - data == MBEDTLS_X509_MAX_DN_NAME_SIZE) {
return MBEDTLS_ERR_X509_INVALID_NAME;