Although you wouldn't be following the spec I think 255 would be fine. I have never allowed email addresses longer than 80 characters in any of my databases and I have never had an issue. I'm guessing but I imagine 95% of emails are less than 30 characters.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 10
I have a rule of thumb for this cruft that I have found to result in much fewer buffer overflow issues - provide double the theoretical maximum (plus a terminating null character). So, in this case I'd simply use a buffer size of 1024 and be done with it. There are other techniques that can be applied if there is a possibility that something could pass a string longer than that to you (a hacker, for example).
rubberman
Posting Maven
2,696 posts since Mar 2010
Reputation Points: 378
Solved Threads: 316
Skill Endorsements: 53
If somebody entered 300 spaces before and after the email address, I quess it would be legitimated. You are stripping spaces from ends, aren't you?
pyTony
pyMod
6,331 posts since Apr 2010
Reputation Points: 879
Solved Threads: 989
Skill Endorsements: 27