Преглед изворни кода

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 година
родитељ
комит
c32a0be89c
1 измењених фајлова са 4 додато и 0 уклоњено
  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;