When trying to use '\x05'
in a string, the compiled C code seems to behave oddly when handling the value.
For instance when using the following string:
char *weird = "\x04\x68\x65\x79\x79\x03\x6e\x65\x74\x05\x6c\x6f\x63\x61\x6c\x00";
When printing each character of the string, the '\x05'
is not corresponding to the integer 5, whereas the '\x04'
and '\x03'
are corresponding to the integers 4 and 3 respectively.
The following for loop demonstrates the problem:
for(int i = 0; i < strlen(question); i++){
printf("question[%d] = %c\n", i, question[i]);
}
Output:
Any ideas why this specific case of '\x05'
is so troublesome?