diff options
author | Rich Salz <rsalz@akamai.com> | 2019-09-16 15:28:57 -0400 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-10-09 21:32:15 +0200 |
commit | 12a765a5235f181c2f4992b615eb5f892c368e88 (patch) | |
tree | 67ece1a3fb210bd4895aea73649773fc912a60d6 /crypto/ocsp | |
parent | 3a4e43de473ee80347036d78163889b6b1221210 (diff) |
Explicitly test against NULL; do not use !p or similar
Also added blanks lines after declarations in a couple of places.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9916)
Diffstat (limited to 'crypto/ocsp')
-rw-r--r-- | crypto/ocsp/ocsp_ht.c | 10 | ||||
-rw-r--r-- | crypto/ocsp/ocsp_lib.c | 15 |
2 files changed, 11 insertions, 14 deletions
diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c index c75bfdb403..fa147f3b16 100644 --- a/crypto/ocsp/ocsp_ht.c +++ b/crypto/ocsp/ocsp_ht.c @@ -142,7 +142,7 @@ int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path) { static const char http_hdr[] = "%s %s HTTP/1.0\r\n"; - if (!path) + if (path == NULL) path = "/"; if (BIO_printf(rctx->mem, http_hdr, op, path) <= 0) @@ -211,7 +211,7 @@ static int parse_http_line1(char *line) for (p = line; *p && !ossl_isspace(*p); p++) continue; - if (!*p) { + if (*p == '\0') { OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR); return 0; } @@ -220,7 +220,7 @@ static int parse_http_line1(char *line) while (*p && ossl_isspace(*p)) p++; - if (!*p) { + if (*p == '\0') { OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR); return 0; } @@ -229,7 +229,7 @@ static int parse_http_line1(char *line) for (q = p; *q && !ossl_isspace(*q); q++) continue; - if (!*q) { + if (*q == '\0') { OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR); return 0; } @@ -258,7 +258,7 @@ static int parse_http_line1(char *line) } if (retcode != 200) { OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_ERROR); - if (!*q) + if (*q == '\0') ERR_add_error_data(2, "Code=", p); else ERR_add_error_data(4, "Code=", p, ",Reason=", q); diff --git a/crypto/ocsp/ocsp_lib.c b/crypto/ocsp/ocsp_lib.c index 90a92b9e60..a027062ccf 100644 --- a/crypto/ocsp/ocsp_lib.c +++ b/crypto/ocsp/ocsp_lib.c @@ -132,8 +132,7 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, /* Check for initial colon */ p = strchr(buf, ':'); - - if (!p) + if (p == NULL) goto parse_err; *(p++) = '\0'; @@ -156,10 +155,8 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, host = p; /* Check for trailing part of path */ - p = strchr(p, '/'); - - if (!p) + if (p == NULL) *ppath = OPENSSL_strdup("/"); else { *ppath = OPENSSL_strdup(p); @@ -167,7 +164,7 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, *p = '\0'; } - if (!*ppath) + if (*ppath == NULL) goto mem_err; p = host; @@ -175,7 +172,7 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, /* ipv6 literal */ host++; p = strchr(host, ']'); - if (!p) + if (p == NULL) goto parse_err; *p = '\0'; p++; @@ -188,12 +185,12 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, } *pport = OPENSSL_strdup(port); - if (!*pport) + if (*pport == NULL) goto mem_err; *phost = OPENSSL_strdup(host); - if (!*phost) + if (*phost == NULL) goto mem_err; OPENSSL_free(buf); |