C# - 这是什么" \0"等同于? [英] C# - What does "\0" equate to?
问题描述
我玩 Pex的并把它传递到我的方法的参数之一就是\0
。
I am playing with Pex and one of the parameters it passes into my method is "\0"
.
这是什么意思?我的猜测是一个空字符串(,
)的基础上我的方法的内容。但是,如果是相同的,那么为什么不直接使用,
而不是\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?
推荐答案
\0'是一个空字符。它用于终止C字符串和C ++的某些部分。 PEX是做一个测试,看看你的代码是如何处理空字符,可能找毒空字节 。安全漏洞
'\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.
大多数C#代码有什么好怕的;如果你通过字符串非托管代码,但是,您可能会遇到问题。
Most C# code has nothing to fear; if you pass your string to unmanaged code, however, you may have problems.
编辑:
只是要明确... Pex公司正在传递包含一个空字符串。这是的不的空引用。
Just to be explicit... Pex is passing a string containing a null character. This is not a null reference.
这篇关于C# - 这是什么" \0"等同于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!