truncating and returning an error saying that you did so leaves the error checking up to the programmer where it belongs.
sometimes programmers will not check error conditions properly, if they don't their software will have problems no matter what the library routines do.
If I have a service serving thousands of users per second, shutting the entire service down because someone entered a too-long string is unlikely to be what I want to have happen.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds