The fact is though buffer overflows are never this blatant so a more useful example in C would involve C functions anyway, such as scanf or sprintf, and even those are just the functions you would actually use.
I remember when someone else demonstrated dynamic format strings, might as well use that.
Code:
sprintf(format , "%%%us , %%%us %%%us", lastSize, firstSize, phoneSize);
sprintf(line, format, entries[ foo ].firstName, entries[ foo ].lastName, entries[ foo ].phone);
If any of the sizes overflow, you also potentially have an overflow problem in your string buffers. Isn't that fun? Of course, C++ can have buffer overflows, but unlike Elysia, I don't see much point in an example that works in both languages. You can do things totally differently in C++ so finding a similar error that is equally likely for both languages is hard. Finding an error that works in both languages when you're actually trying is nightmare mode.