Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am not sure how will this program behave?
I ran this code but I am not able to figure out any reasoning behind the way it works
int main()
{
return main();
}
main() is a function by itself. The line return main() calls the function again. So in effect it should run an infinite loop. You wouldn't get any output (you said you ran it. didn't it crash?).
In reality it would be like staring into a mirror with another mirror placed behind you. You would only see endless reflections. . :)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am doing a project on railway reservation system, my program is working fine, but when I close the program and then again start booking tickets,seat no again takes the previous value, I'm doing the project in c.
You'll need to write all of the data to a file before the program closes, and then read the data from the file when the program starts again.
That's right.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I getting code 0 error while compiling very simple code. How do I solve it?
I using VS 2017 for the first time.
#include <stdio.h>
void main()
{
printf("My name is Haim");
}
The two rows in the middle are not supposed to be there!
Haim
Your main() should return some exit code. So int should be as the return type.
In the other hand exit code 0 means, that everything was succesfull, see.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I just had a question that whenever I write code I had to call all functions (predefined or user defined) in order to use or execute them. So why we don't have to call main function?
The main function is defined by the language itself as the designated start of the program. You don't need to call it because, in effect, your operating system (Linux, macOS, Windows, etc.) does.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Presuming I have a program in C:
#include<stdio.h>
#include<time.h>
int main()
{
int a = rand() % 1000;
return 0;
}
How can I find the value of "a" without printing it on the console, but by accessing, with a linux terminal command, its address to read the value from it?
Or generally, how can I map all the written values of a binary without seeing its implementation (like a "blackbox")?
Memory is accessible via /proc/pid/mem, index is /proc/pid/maps, Python prototype is how-do-i-read-from-proc-pid-mem-under-linux.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am calling a shellcode using buffer overflow to spawn a root shell. Can somebody explain what this shellcode exactly does? I have tried different shellcodes to spawn a root shell, but this was the only one which worked for me.
\x31\xdb\x89\xd8\xb0\x17\xcd\x80\x31\xdb
\x89\xd8\xb0\x2e\xcd\x80\x31\xc0\x50\x68
\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89
\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd
\x80
On first glance, the code appears to do setuid(0), then setgid(0), then call sys_execve() on some values (which include ASCII codes for "/bin//sh").
Looks like this is pure "payload" code, since I don't see anything to ensure the code is executed on the first place (buffer overflow, stack smashing, etc.).
(Thanks to #Hans Lub for the disassembler link)