]> Zhao Yanbai Git Server - minix.git/commitdiff
Solve buffer overflow on tab completion in ash
authorErik van der Kouwe <erik@minix3.org>
Mon, 23 Aug 2010 16:30:58 +0000 (16:30 +0000)
committerErik van der Kouwe <erik@minix3.org>
Mon, 23 Aug 2010 16:30:58 +0000 (16:30 +0000)
lib/libedit/complete.c

index d454dc4d049d4a3fa14191c932b6fc1db50f6d58..cfdff493fad282d1c2b29d7bb428be82ca3e910d 100644 (file)
@@ -188,7 +188,7 @@ rl_complete(pathname, unique)
     if (ac == 1) {
        /* Exactly one match -- finish it off. */
        *unique = 1;
-       j = strlen(av[0]) - len + 2;
+       j = strlen(av[0]) - len + 1;
        if ((p = NEW(char, j + 1)) != NULL) {
            COPYFROMTO(p, av[0] + len, j);
            if ((new = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) {