Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - What does "\0" equate to?

Tags:

I am playing with Pex and one of the parameters it passes into my method is "\0".

What does that mean? My guess is an empty string ("") based on the content of my method. However, if it is the same then why not just use "" instead of "\0"?

Anyone know what it is?

like image 488
Vaccano Avatar asked Feb 18 '10 22:02

Vaccano


1 Answers

'\0' is a "null character". It's used to terminate strings in C and some portions of C++. Pex is doing a test to see how your code handles the null character, likely looking for the Poison Null Byte security exploit.

Most C# code has nothing to fear; if you pass your string to unmanaged code, however, you may have problems.

Edit:

Just to be explicit... Pex is passing a string containing a null character. This is not a null reference.

like image 111
Randolpho Avatar answered Nov 13 '22 01:11

Randolpho