Proper implementation of input checking