Revert "Fix DOS vulnerabilities reported by "8ARTEK0V0""

This reverts commit e97c4bb005ad5d98ceb04298e9921781720a1dca.
Revert "Revert "Fix DOS vulnerabilities reported by "8ARTEK0V0"""

This reverts commit 03b142da6e63c24a99e424d0b2d29b310e601ad6.