fix a DoS vulnerability (re #67), originally identified by Luigi Auriemma