From: Erik van der Kouwe Date: Mon, 23 Aug 2010 16:30:58 +0000 (+0000) Subject: Solve buffer overflow on tab completion in ash X-Git-Tag: v3.1.8~56 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch11.html?a=commitdiff_plain;h=d743c5c6f39d6c9700174e156cc4284c36f2dea9;p=minix.git Solve buffer overflow on tab completion in ash --- diff --git a/lib/libedit/complete.c b/lib/libedit/complete.c index d454dc4d0..cfdff493f 100644 --- a/lib/libedit/complete.c +++ b/lib/libedit/complete.c @@ -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) {