Change behaviour away from NUL-terminated strings

Instead, require the length of the string to be passed. This is more
useful for our use-case, as it is likely we will parse OIDs from the
middle of strings.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/oid.c b/library/oid.c
index 87e5d89..312a637 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -960,7 +960,7 @@
     size_t encoded_len;
     unsigned char *minimum_mem;
 
-    for (size_t i = 0; (i < size) && (oid_str[i] != '\0'); i++) {
+    for (size_t i = 0; i < size; i++) {
         if (oid_str[i] == '.') {
             num_dots++;
         }
@@ -1003,7 +1003,7 @@
         ret = MBEDTLS_ERR_ASN1_INVALID_DATA;
         goto error;
     }
-    if (str_ptr < str_bound && *str_ptr != '\0') {
+    if (str_ptr < str_bound) {
         if (*str_ptr == '.') {
             str_ptr++;
         } else {
@@ -1022,12 +1022,12 @@
         goto error;
     }
 
-    while (str_ptr < str_bound && *str_ptr != '\0') {
+    while (str_ptr < str_bound) {
         ret = oid_parse_number(&val, &str_ptr, str_bound);
         if (ret != 0) {
             goto error;
         }
-        if (str_ptr < str_bound && *str_ptr != '\0') {
+        if (str_ptr < str_bound) {
             if (*str_ptr == '.') {
                 str_ptr++;
             } else {