Here is a link to a number of suggestions I have compiled for hardening of firmware.
I'm pretty sure that a lot can be said about the list, so please post coding tips or links to pages with good information of software hardening.
iapetus.neab.net/.../hardening.html
Suddenly, the new software stands there on a shelf in in the shop. The shrink-wrapped box with the unreadable manual and all juridical notes about disclaimers and limitation of liabilities is the result of careful work and rigid quality control. This is what the development cycle looks like:
1) The developer creates what he thinks is bug-free code.
2) The program is tested and 20 bugs found.
3) The developer fixes 10 of the bugs, and declares that the remaining are not really bugs.
4) The test department realizes that 5 of the fixes does not work, and finds 15 new bugs.
5) See point 3.
6) See point 4.
7) See point 5.
8) See point 6.
9) See point 7.
10) See point 8.
11) After pressure from the market department, and a too early released press release based on an overoptimistic time schedule, the program is relesed.
12) Early users finds a further 137 bugs.
13) The developer, who have had his final invoice payed can't be reached.
14) A quickly gathered team of developers fixes most of the bugs, while in the progres introducing 456 new.
15) The test department gets a postcard from Bali from the first developer. All testers quits.
16) The company is bought by a competitor for the profit of their last program release, that had 783 bugs.
17) The board recruits a new president that employs a developer ready to develop a new program from scratch.
18) The developer creates what he thinks is bug-free code. See 2.