浏览代码

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;