git-rm: fix possible segfault
PATCH 1/1 git-rm: fix possible segfault
Signed-off-by SungHyun Nam <[email protected]>
--- builtin-rm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
builtin-rm.c +3 -0
@@ -83,6 +83,9 @@ int cmd_rm(int argc, const char **argv, }die (builtin_rm_usage); } +if (i >= argc) +usage (builtin_rm_usage); + pathspec =get_pathspec (prefix, argv + i); seen =NULL ;
Signature · 1 line
1.4.0.rc1.gfd7e
Quoted 11 lines · SungHyun Nam
Signed-off-by SungHyun Nam <[email protected]>--- builtin-rm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)builtin-rm.c +0
-0
builtin-rm.c int cmd_rm(int argc, const char **argv, · line 91
Quoted 9 lines
builtin-rm.c +3
-0@@ -83,6 +83,9 @@ int cmd_rm(int argc, const char **argv, }die (builtin_rm_usage); } +if (i >= argc) +usage (builtin_rm_usage); + pathspec =get_pathspec (prefix, argv + i); seen =NULL ;
Thanks. The real problem is it uses pathspec even when no paths is specified, but "git rm" without any arguments would remove everything under the sun with the normal pathspec semantics, so refusing to run when no paths are specified like you did makes sense.
There is a more grave bug in git-rm (I do not use this command myself at all, so I did not spot it earlier). I'll push out a fix soonish.