Skip to content
Advertisement

Tag: c++

What is vulnerable about this C code?

The way I understand it, the code above allows arbitrary code (or program) execution — what makes this vulnerable, and how does one take advantage of this? Answer You can override the PATH variable to point to a directory with your custom version of echo and since echo is executed using env, it isn’t treated as a built-in. This constitues

Undefined references in makefile

Ok, ive read about 10 tutorials, but i keep getting errors all the time, i have 5 files, main.cpp class.cpp, class.h and functions.cpp and functions.h. All of those use functions from different objects meaning that functions in functions.cpp uses objects from classes.cpp. My makefile looks as follows I keeps telling me that it has undefined references. What am i missing?

Is malloc deterministic?

Is malloc deterministic? Say If I have a forked process, that is, a replica of another process, and at some point both of them call the malloc function. Would the address allocated be the same in both processes? Assuming that other parts of execution are also deterministic. Note: Here, I’m only talking about virtual memory, not physical one. Answer There

Why makecontext does not work with pthreads

From makecontext() manual… Due to limitations in the current pthread implementation, makecontext should not be used in programs which link against the pthread(3) library (whether threads are used or not). Now my question is, why it doesn’t work and what are the alternative methods. Actually I’m interested in switching stacks in a user-level thread at some points, but I’m seeing

Turn on core/crash dumps programmatically

I know I can run “ulimit -c unlimited” In the shell to turn on core dumps for the current user. What I am wondering is how can I do this programmatically from C? I see there is a ulimit call, but it’s been deprecated in favour of get/setrlimit. What I want to know is what is the equivalent call to

undefined reference to sync_fetch_and_add_4

Whenever I try to use __sync_fetch_and_add with -m32 on a 64 bit machine, I get the following error, while it compiles fine with normal 64 bit. I am using gcc compiler 4.1.2. What can be the problem here and what is the solution? Answer Using -march=i486 flag did the trick for me.

Advertisement