Memory overflow caused by 'basedir regex', bug #567

Authored-by: Takao Shimayoshi
Reviewed-by: Ralph Boehme <rb@sernet.de>