fixed port input validation to prevent code injection