Jelajahi Sumber

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.
Dennis Yurasov 4 tahun lalu
induk
melakukan
c32a0be89c
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      src/modules/ndb_redis/redis_client.c

+ 4 - 0
src/modules/ndb_redis/redis_client.c

@@ -1269,6 +1269,10 @@ int redisc_check_auth(redisc_server_t *rsrv, char *pass)
 	int retval = 0;
 
 	reply = redisCommand(rsrv->ctxRedis, "AUTH %s", pass);
+	if(!reply) {
+		LM_ERR("Redis authentication error\n");
+		return -1;
+	}
 	if (reply->type == REDIS_REPLY_ERROR) {
 		LM_ERR("Redis authentication error\n");
 		retval = -1;