char s[] = {'w','o','r','l','d', '\n'};
int main() {
printf("hello %s", s);
}
This snippet of code produce the following decompiled code
undefined8 main(void)
{
printf("hello %s",s);
return 0;
}
I was wondering if there's any chance to get the value of the char array instead of its name. Am i missing something?
I've compiled this snippet both for AARCH64 and x86_64 with gcc and it produce the same decompiled code.
In IDA hex-rays options if i untick "Print only constant string literals" i can get the following decompiled code:
int __cdecl main(int argc, const char **argv)
{
printf("hello %s", "world\n");
return 0;
}
Thank you in advance.
It will depend on if the value is in a memory section that is read-only.
Thank you for the answer, i solved the problem by setting the mutability to constant on the string. I consider this issue solved and closing it.
馃憤
Most helpful comment
Thank you for the answer, i solved the problem by setting the mutability to constant on the string. I consider this issue solved and closing it.