Bash-4.1 distribution source
diff --git a/general.c b/general.c
index 4cf877f..26c7d3d 100644
--- a/general.c
+++ b/general.c
@@ -98,7 +98,7 @@
neg = 0;
while (s && *s && whitespace (*s))
s++;
- if (*s == '-' || *s == '+')
+ if (s && (*s == '-' || *s == '+'))
{
neg = *s == '-';
s++;
@@ -285,7 +285,7 @@
#if defined (ARRAY_VARS)
if (c == '[')
{
- newi = skipsubscript (string, indx);
+ newi = skipsubscript (string, indx, 0);
if (string[newi++] != ']')
return (0);
if (string[newi] == '+' && string[newi+1] == '=')
@@ -577,7 +577,7 @@
absolute_program (string)
const char *string;
{
- return ((char *)xstrchr (string, '/') != (char *)NULL);
+ return ((char *)mbschr (string, '/') != (char *)NULL);
}
/* **************************************************************** */
@@ -717,7 +717,7 @@
for (ndirs = 0, ntail = nbeg; *ntail; ntail++)
if (*ntail == '/')
ndirs++;
- if (ndirs <= nskip)
+ if (ndirs < nskip)
return name;
for (ntail = (*nend == '/') ? nend : nend - 1; ntail > nbeg; ntail--)