Browse code

ndb_redis: fix SIGSEGV in redisc_check_auth

- Added the check for NULL pointer. When TCP session to redis reset,
redisCommand function can return NULL pointer.

(cherry picked from commit c32a0be89cc92a0649277774d1e7aebf349b8b49)
(cherry picked from commit 5dbf99eb03aba76905aa926a55aedd3caa0fcd05)
(cherry picked from commit f3d7a0f52152adf2b3a0da8b44b615486a7f579f)

Dennis Yurasov authored on 24/08/2021 14:15:24 • Henning Westerholt committed on 22/10/2021 12:10:20
Showing 1 changed files
... ...
@@ -1197,6 +1197,10 @@ int redisc_check_auth(redisc_server_t *rsrv, char *pass)
1197 1197
 	int retval = 0;
1198 1198
 
1199 1199
 	reply = redisCommand(rsrv->ctxRedis, "AUTH %s", pass);
1200
+	if(!reply) {
1201
+		LM_ERR("Redis authentication error\n");
1202
+		return -1;
1203
+	}
1200 1204
 	if (reply->type == REDIS_REPLY_ERROR) {
1201 1205
 		LM_ERR("Redis authentication error\n");
1202 1206
 		retval = -1;