Editing 2700: Account Problems

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 53: Line 53:
 
* Failure to handle strings containing null characters correctly can result in security vulnerabilities. For example, including a null character in crafted input may allow a user to read or write files that they are not supposed to be able to access.[https://insecure.org/news/P55-07.txt][https://elixirforum.com/t/static-and-session-security-fixes-for-plug/3913]
 
* Failure to handle strings containing null characters correctly can result in security vulnerabilities. For example, including a null character in crafted input may allow a user to read or write files that they are not supposed to be able to access.[https://insecure.org/news/P55-07.txt][https://elixirforum.com/t/static-and-session-security-fixes-for-plug/3913]
  
βˆ’
* In C, a string is usually stored in a block of memory that is allocated to have a known size. The maximum size of string that can be stored in such a buffer is one character less than the buffer's size, since the last character is used for the null terminator. Language functions that operate on strings, such as those that return the length of a specified string or which compare two strings, look for the terminator as a marker. However, there is a risk in using this feature: if that terminator is somehow overwritten by some other value, a function which assumes that there is still a stopping point may go far beyond the intended region of memory before it happens to find an unrelated terminator or otherwise is forced to stop looking. This can have serious security implications, as well as the potential for bugs and crashes. Instead, safe programming uses versions of the string functions that include a specification of the maximum allowed length. For example, the <code>strlen()</code> function takes a pointer to a string, counts the number of characters until it encounters a null terminator, and returns that number: the length of the string not including the terminator.  The <code>str'''n'''len()</code> function takes a pointer to a string and a maximum length, and counts characters until it either finds a terminator or reaches the maximum.
+
* In C, a string is usually stored in a block of memory that is allocated to have a known size. The maximum size of string that can be stored in such a buffer is one character less than the buffer's size, since the last character is used for the null terminator. Language functions that operate on strings, such as those that return the length of a specified string or which compare two strings, look for the terminator as a marker. However, there is a risk in using this feature: if that terminator is somehow overwritten by some other value, a function which assumes that it's a stopping point may go far beyond the intended region of memory before it happens to find a terminator. This can have serious security implications, as well as the potential for bugs and crashes. Instead, safe programming uses versions of the string functions that include a specification of the maximum allowed length. For example, the <code>strlen()</code> function takes a pointer to a string, counts the number of characters until it encounters a null terminator, and returns that number: the length of the string not including the terminator.  The <code>str'''n'''len()</code> function takes a pointer to a string and a maximum length, and counts characters until it either finds a terminator or reaches the maximum.
  
 
* The number of the xkcd comic is 2700. When interpreting this as two concatenated octal numbers \27 + \00 it represents both the {{w|End-of-Transmission-Block_character|ETB}} as well as the null character, both of these characters possibly leading to problems when processed in legacy systems (e.g. mainframe computers). When interpreting 2700 as hexadecimal 0x27 + 0x00 numbers it represents the ' character and the null character - a sequence that could lead to [[327: Exploits of a Mom|SQL injection]] when it is placed in unescaped form inside of a SQL command.
 
* The number of the xkcd comic is 2700. When interpreting this as two concatenated octal numbers \27 + \00 it represents both the {{w|End-of-Transmission-Block_character|ETB}} as well as the null character, both of these characters possibly leading to problems when processed in legacy systems (e.g. mainframe computers). When interpreting 2700 as hexadecimal 0x27 + 0x00 numbers it represents the ' character and the null character - a sequence that could lead to [[327: Exploits of a Mom|SQL injection]] when it is placed in unescaped form inside of a SQL command.

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)