The third edition of Security Engineering: A Guide to Building Dependable Distributed Systems by Ross Anderson is not yet in print. Professor Anderson presently distributes digital copies of the book’s chapters for free.
Aquinas is an interactive learning system that aims to teach computer programming and exploit development.
There exist many guides to teach network programming. Stevens' TCP/IP Illustrated volumes remain a solid resource. Beej’s Guide to Network Programming is a popular resource for up-and-coming C programmers. Go provides a net package that is suitable for network programming. Python also provides a networking package, along with documentation.
The CERT C Coding Standard enumerates a number of rules that aim to avoid the many pitfalls of the C programming language.