Null characters in ansistring

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Null characters in ansistring

L505
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.

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.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Null characters in ansistring

Michael Van Canneyt


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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal