Apply some validation to the git-branch argument.
Changed various sprintf calls to snprintf.