Index: E:/Programmazione/Python/Sources/[PRJ] - pyftpdlib/__svn/python/Lib/smtpd.py =================================================================== --- E:/Programmazione/Python/Sources/[PRJ] - pyftpdlib/__svn/python/Lib/smtpd.py (revision 60222) +++ E:/Programmazione/Python/Sources/[PRJ] - pyftpdlib/__svn/python/Lib/smtpd.py (working copy) @@ -115,6 +115,7 @@ self.__conn = conn self.__addr = addr self.__line = [] + self.__linelen = 0 self.__state = self.COMMAND self.__greeting = 0 self.__mailfrom = None @@ -133,12 +134,18 @@ # Implementation of base class abstract method def collect_incoming_data(self, data): self.__line.append(data) + self.__linelen += len(data) + if self.__linelen > 998: + self.push('500 Line too long') + self.__line = [] + self.__linelen = 0 # Implementation of base class abstract method def found_terminator(self): line = EMPTYSTRING.join(self.__line) print >> DEBUGSTREAM, 'Data:', repr(line) self.__line = [] + self.__linelen = 0 if self.__state == self.COMMAND: if not line: self.push('500 Error: bad syntax') @@ -544,6 +551,6 @@ proxy = class_((options.localhost, options.localport), (options.remotehost, options.remoteport)) try: - asyncore.loop() + asyncore.loop(timeout=1.0) except KeyboardInterrupt: pass