Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type.

learn more… | top users | synonyms

28
votes
3answers
1k views

Can we return string literal in C [duplicate]

Is this code valid? const char* foo() { return "Hello World"; } That is, return "Hello World" from a C function. const char* str = foo(); Will str be a dangling pointer? PS: The above ...
0
votes
5answers
81 views

How to avoid returning handles to object internals - Item 28 Effective C++

Item 28 of Effective C++ says avoid returning "handles" to object internals. This question shows how to design your code to do exactly that by thinking about encapsulation in order to avoid ...
2
votes
2answers
252 views

Sieve of Eratosthenes algorithm in C

Okay, so this function I created uses the Sieve of Eratosthenes algorithm to compute all the primes <= n. This function stores the prime numbers and the count of primes in the parameters. When ...
5
votes
1answer
250 views

What is the most hardened set of options for GCC compiling C/C++?

What set of GCC options provide the best protection against memory corruption vulnerabilities such as Buffer Overflows, and Dangling Pointers? Does GCC provide any type of ROP chain mitigation? Are ...