This change fixes a potential exploitable vulnerability that can cause the WAL to be consistently truncated by falsely supplying the WAL path which would be any arbitrary dirrectory. Fixes #6427