An original poster asked for books or links related to secure programming that describe how buffer overflows, race conditions and others can cause security vulnerabilities in programs.
Dave McKinney of Security Focus has collated together a very good list of books and a few links about secure programming, hacking, exploitation etc. This is an excellent resource for those who want to know how programs get exploited. Buffer overflows seem to be very popular in alert 68 for instance. If you are interested in security then you should understand what are the techniques used by hackers and how they actually work.