From cef115ff0ca4255d3decc1dda87c5418a961fd2c Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Fri, 8 Dec 2017 10:25:38 -0500 Subject: [PATCH] Fix an incoherent test. Pointer 'o' is set inside a local buffer, so it can't be NULL. Also fix coding style and add comments Reviewed-by: Tim Hudson Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/4754) --- crypto/objects/obj_dat.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 3f65d37bc6..06a3fb3406 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -632,6 +632,10 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num, return p; } +/* + * Parse a BIO sink to create some extra oid's objects. + * Line format: + */ int OBJ_create_objects(BIO *in) { char buf[512]; @@ -653,9 +657,9 @@ int OBJ_create_objects(BIO *in) *(s++) = '\0'; while (ossl_isspace(*s)) s++; - if (*s == '\0') + if (*s == '\0') { s = NULL; - else { + } else { l = s; while (*l != '\0' && !ossl_isspace(*l)) l++; @@ -663,14 +667,17 @@ int OBJ_create_objects(BIO *in) *(l++) = '\0'; while (ossl_isspace(*l)) l++; - if (*l == '\0') + if (*l == '\0') { l = NULL; - } else + } + } else { l = NULL; + } } - } else + } else { s = NULL; - if ((o == NULL) || (*o == '\0')) + } + if (*o == '\0') return num; if (!OBJ_create(o, s, l)) return num; -- 2.25.1