[fpc-pascal] Null characters in ansistring

Michael Van Canneyt michael at freepascal.org
Fri Jan 27 09:16:53 CET 2006



On Thu, 26 Jan 2006, L505 wrote:

> If there is a null character in the middle or somewhere inside an ansistring, this
> does not affect it's length, correct? Unless casting with pchars in play.

This is correct.

> Reason I ask is that I wonder if it is a good idea to strip all incoming null
> characters for web/internet security reasons. If someone inserts a null character and
> they get stripped, this is safer than keeping them there and offering some
> compatibility in case some odd person chose to store null characters in his string.
> Probably that would only be used in rare cases such as a delimited file with null
> characters.

I think it's safe to strip them, if you are expecting text.

Michael.



More information about the fpc-pascal mailing list