3 ms·
> There is no question of what format is this header, how wide is this length field and so on. It's not that simple. You either have forbidden characters then,
by viraptor 8y ago
> There is no question of what format is this header, how wide is this length field and so on.
It's not that simple. You either have forbidden characters then, or escaping - and with the latter you don't know how wide the content is. Null-termination in fields is a common security issue.
- kazinator 8y agoForbidden characters can occur in other string representations, like length + data. Escape sequences are higher level syntax being represented by the string; they don't belong in the string representation. A transfer encoding like UTF-8 isn't a string representation either. Manipulation of syntaxes and encodings stored in character strings can be buggy. The representation does contribute to the risk. E.g. if a UTF-8 decoder doesn't reject overlong forms, then a null character can be encoded in the middle of the data so that to the buggy function or program, it looks like a different string from one that was validated earlier.