Writing Shared Libraries, first draft

Mike Hearn mike at navi.cx
Fri Nov 5 19:19:37 EET 2004


On Fri, 05 Nov 2004 11:15:40 -0500, Sean Middleditch wrote:
> Wrong again.  Application code will often have something like:
> 
> struct library_foo my_foo;
> 
> Now that app brakes when linked against a version of the library with a
> different library_foo size, independent of whether the struct is passed
> by value - as soon as some library code tries to access non-existent
> members of the struct, corruption or crashes occur.

To clarify this point, changing (increasing) struct sizes can cause stack
smashing in the case of code like this:

{
	struct foo bar;

	foolib_set_bar(&bar);
}

which is obviously a very common idiom.





More information about the xdg mailing list