{"thread":{"id":"4441","subject":"[PATCH] git-rm: fix possible segfault","startedAt":"2006-06-09T02:10:44Z","lastAt":"2006-06-09T04:15:39Z","messageCount":2,"participants":["SungHyun Nam","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"21461","messageId":"20060609111044.451c94b1@namsh.wimo.co.kr","threadId":"4441","inReplyTo":null,"subject":"[PATCH] git-rm: fix possible segfault","fromName":"SungHyun Nam","fromEmail":"goweol@gmail.com","sentAt":"2006-06-09T02:10:44Z","receivedAt":"2006-06-09T02:10:44Z","isPatch":true,"sender":{"key":"goweol@gmail.com","avatar":null},"body":"\nSigned-off-by: SungHyun Nam <goweol@gmail.com>\n\n---\n builtin-rm.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex ef2f8b5..aeda415 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -83,6 +83,9 @@ int cmd_rm(int argc, const char **argv, \n \t\t}\n \t\tdie(builtin_rm_usage);\n \t}\n+\tif (i >= argc)\n+\t\tusage(builtin_rm_usage);\n+\n \tpathspec = get_pathspec(prefix, argv + i);\n \n \tseen = NULL;\n-- \n1.4.0.rc1.gfd7e\n"},{"id":"21467","messageId":"7vverbnevo.fsf@assigned-by-dhcp.cox.net","threadId":"4441","inReplyTo":"20060609111044.451c94b1@namsh.wimo.co.kr","subject":"Re: [PATCH] git-rm: fix possible segfault","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-09T04:15:39Z","receivedAt":"2006-06-09T04:15:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SungHyun Nam <goweol@gmail.com> writes:\n\n> Signed-off-by: SungHyun Nam <goweol@gmail.com>\n>\n> ---\n>  builtin-rm.c |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n>\n> diff --git a/builtin-rm.c b/builtin-rm.c\n> index ef2f8b5..aeda415 100644\n> --- a/builtin-rm.c\n> +++ b/builtin-rm.c\n> @@ -83,6 +83,9 @@ int cmd_rm(int argc, const char **argv, \n>  \t\t}\n>  \t\tdie(builtin_rm_usage);\n>  \t}\n> +\tif (i >= argc)\n> +\t\tusage(builtin_rm_usage);\n> +\n>  \tpathspec = get_pathspec(prefix, argv + i);\n>  \n>  \tseen = NULL;\n\nThanks.  The real problem is it uses pathspec even when no paths\nis specified, but \"git rm\" without any arguments would remove\neverything under the sun with the normal pathspec semantics, so\nrefusing to run when no paths are specified like you did makes\nsense.\n\nThere is a more grave bug in git-rm (I do not use this command\nmyself at all, so I did not spot it earlier).  I'll push out a\nfix soonish.\n"}]}