A system is trying to telnet to a server a number of times continueously. Is there a possiblity that the process trying to telnet may crash due to buffer overflow? My situation is a perl program in a loop trying 500 times in 10 seconds opening a telnet connection and closing.
We'd need to see the Perl program (and I'm assuming you have it otherwise how would you know it's Perl).
One possibility is that the Perl script is not recognizing the login strings presented by your telnet daemon and so is shutting down the connection and retrying.
I'm not sure why you'd think it was a buffer overflow (unless you have information that we don't). It seems to me that if Perl (the interpreter, not the script) had a buffer overflow, it would just crash and there would be no retries (assuming there's not something else retrying the script).
If you think your script has a buffer overflow problem, again we'd need to see it to help you out.
Telnetting 500 times in 10 seconds shouldn't crash your client program, but I doubt your telnet and login processes on the server can keep up with that kind of a connection rate. You need to figure out a way to leave the telnet connection open or switch to a protocol designed for polling, such as SNMP.
All that said, you didn't indicate what Telnet library or program you're using, so the possibility is certainly out there that it is buggy.
In short, I don't think your use case is really in spec for Telnet.
Why can't you just leave the telnet connection open?
I would open just a single telnet connection and leave it open and use it to send and receive data. If there is no response in a specified timeout than close it and open it again.