Re: minor problems in git.c
On Thu, Dec 01, 2005 at 01:48:35PM +0100, Alex Riesen wrote:
Show 9 quoted lines
> @@ -283,16 +283,15 @@ int main(int argc, char **argv, char **e
> len = strlen(git_command);
> prepend_to_path(git_command, len);
>
> - strncat(&git_command[len], "/git-", sizeof(git_command) - len);
> - len += 5;
> - strncat(&git_command[len], argv[i], sizeof(git_command) - len);
> + snprintf(git_command + len, sizeof(git_command) - len, "/git-%s",
> + argv[i]);
Shouldn't you check the return value of snprintf
> if (access(git_command, X_OK))
> usage(exec_path, "'%s' is not a git-command", argv[i]);
or use the (possibly) truncated version of the command in the error message ?
skimo