Steps in fixing
Narrow down to a few files (usually using grep or lxr).
Make backups of each file before editing it (or keep a backup tarball or jar).
Search within files for relevant code.
Try, test, try, repeat.
Next:
Steps for C and C++