Skip to content

Commit

Permalink
Merge pull request #1091 from redis/ssl-error-ub-fix
Browse files Browse the repository at this point in the history
Fix some undefined behavior
  • Loading branch information
michael-grunder authored Aug 29, 2022
2 parents 507a6dc + 0ed6cde commit df8b74d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/example-libevent-ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main (int argc, char **argv) {
const char *caCert = argc > 5 ? argv[6] : NULL;

redisSSLContext *ssl;
redisSSLContextError ssl_error;
redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;

redisInitOpenSSL();

Expand Down
7 changes: 3 additions & 4 deletions examples/example-ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
int main(int argc, char **argv) {
unsigned int j;
redisSSLContext *ssl;
redisSSLContextError ssl_error;
redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;
redisContext *c;
redisReply *reply;
if (argc < 4) {
Expand All @@ -27,9 +27,8 @@ int main(int argc, char **argv) {

redisInitOpenSSL();
ssl = redisCreateSSLContext(ca, NULL, cert, key, NULL, &ssl_error);
if (!ssl) {
printf("SSL Context error: %s\n",
redisSSLContextGetError(ssl_error));
if (!ssl || ssl_error != REDIS_SSL_CTX_NONE) {
printf("SSL Context error: %s\n", redisSSLContextGetError(ssl_error));
exit(1);
}

Expand Down

0 comments on commit df8b74d

Please sign in to comment.