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)

Dennis Yurasov authored on 24/08/2021 14:15:24 • Daniel-Constantin Mierla committed on 17/09/2021 07:08:41
Showing 1 changed files
... ...
@@ -1269,6 +1269,10 @@ int redisc_check_auth(redisc_server_t *rsrv, char *pass)
1269 1269
 	int retval = 0;
1270 1270
 
1271 1271
 	reply = redisCommand(rsrv->ctxRedis, "AUTH %s", pass);
1272
+	if(!reply) {
1273
+		LM_ERR("Redis authentication error\n");
1274
+		return -1;
1275
+	}
1272 1276
 	if (reply->type == REDIS_REPLY_ERROR) {
1273 1277
 		LM_ERR("Redis authentication error\n");
1274 1278
 		retval = -1;