I had a sizeof(string) instead of a strlen(string). Issue #2.