Others said it, but ...
Essentially all security vulnerabilities come from data. If your program does not process any data, it can be safe. It can also be pretty useless :).
This leads to what I consider to be the basic concept for ensuring code security:
Do not trust your data. Ever.
, . (, , , Java #), , .