{"thread":{"id":"79","subject":"[PATCH] Fix update-cache --remove fix.","startedAt":"2005-04-17T08:58:42Z","lastAt":"2005-04-17T08:58:42Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"459","messageId":"7v3btp230d.fsf@assigned-by-dhcp.cox.net","threadId":"79","inReplyTo":null,"subject":"[PATCH] Fix update-cache --remove fix.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-17T08:58:42Z","receivedAt":"2005-04-17T08:58:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"There is a boundary case bug in the update-cache --remove fix I\nsent earlier, which results in a segfault when trying to remove\na nonexistent name that sorts later than anything in the\ndircache.  Here is a fix.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n read-cache.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletion(-)\n\nread-cache.c: 60b8efb3201fbf0a67bef48775bd1c9a1ccae2ff\n--- read-cache.c\n+++ read-cache.c\t2005-04-17 01:50:00.000000000 -0700\n@@ -371,7 +371,8 @@\n \tint pos = cache_name_pos(path, strlen(path));\n \tif (pos < 0)\n \t\tpos = -pos-1;\n-\twhile (! strcmp(active_cache[pos]->name, path))\n+\twhile ((pos < active_nr) &&\n+\t       ! strcmp(active_cache[pos]->name, path))\n \t\tremove_entry_at(pos);\n \treturn 0;\n }\n\n"}]}