shithub: choc

Download patch

ref: 6a87a917afb090dab585bce8b2aba5db1accdc6b
parent: 829c1e4c88237715fcd4622bdc9bdeb160761412
author: Simon Howard <fraggle@soulsphere.org>
date: Mon Oct 29 19:24:13 EDT 2018

Oops.

--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -224,13 +224,13 @@
     char *pivot, *tmp;
     int i, left_len, cmp;
 
-    if (len < 2)
+    if (len <= 1)
     {
         return;
     }
-    pivot = filenames[0];
+    pivot = filenames[len - 1];
     left_len = 0;
-    for (i = 1; i < len; ++i)
+    for (i = 0; i < len-1; ++i)
     {
         if ((flags & GLOB_FLAG_NOCASE) != 0)
         {