diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2017-12-08 10:25:38 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-12-08 11:19:37 -0500 |
commit | 6ebcdb354ebcc6a54fb49d4eff8d20f114e43313 (patch) | |
tree | e00dc07273e502ffc1e538a8155503802315e50b /crypto/objects | |
parent | ea4e868a3c6872f4944dd5469518f8b10ee3432c (diff) |
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 <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4754)
(cherry picked from commit cef115ff0ca4255d3decc1dda87c5418a961fd2c)
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/obj_dat.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index fd833be1a1..eb9c470fb1 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:<OID:isdigit or '.']><isspace><SN><isspace><LN> + */ int OBJ_create_objects(BIO *in) { char buf[512]; @@ -653,9 +657,9 @@ int OBJ_create_objects(BIO *in) *(s++) = '\0'; while (isspace((unsigned char)*s)) s++; - if (*s == '\0') + if (*s == '\0') { s = NULL; - else { + } else { l = s; while ((*l != '\0') && !isspace((unsigned char)*l)) l++; @@ -663,15 +667,18 @@ int OBJ_create_objects(BIO *in) *(l++) = '\0'; while (isspace((unsigned char)*l)) l++; - if (*l == '\0') + if (*l == '\0') { l = NULL; - } else + } + } else { l = NULL; + } } - } else + } else { s = NULL; - if ((o == NULL) || (*o == '\0')) - return (num); + } + if (*o == '\0') + return num; if (!OBJ_create(o, s, l)) return (num); num++; |