Bugfix/cve 2009 3721

A basic attempt to fix CVE-2009-3721, a buffer overflow exploit in filename handling.

This also fixes _lots_ of compiler warnings, and adds some basic tests for Travis to run just for basic regression testing.

Addresses #7