Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-01

Null characters in ansistring

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.

Reply by email

Michael Van Canneyt
to L505
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.

Show quoted text 6 lines
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.

Reply by email