From 838e5ffe9e0071859b635151729192dedbf104a7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 19 Mar 1998 14:32:08 +0000 Subject: Update. 1998-03-19 14:28 Ulrich Drepper * sysdeps/generic/strtok_r.c: Make __strtok_r real name and strtok_r weak alias. * sysdeps/i386/strtok_r.c: Likewise. * sysdeps/libm-i387/i686/s_fdim.S: Make it really work. * sysdeps/libm-i387/i686/s_fdimf.S: Likewise. * sysdeps/libm-i387/i686/s_fdiml.S: Likewise. * sysdeps/libm-i387/i686/s_fmin.S: Likewise. * sysdeps/libm-i387/i686/s_fminf.S: Likewise. * sysdeps/libm-i387/i686/s_fminl.S: Likewise. 1998-03-19 Andreas Jaeger * intl/localealias.c: Remove unneeded define for strdup. 1998-03-19 13:45 Ulrich Drepper * manual/argp.texi: Adjust for better TeX output. * manual/arith.texi: Likewise. * manual/conf.texi: Likewise. * manual/filesys.texi: Likewise. * manual/header.texi: Likewise. * manual/lgpl.texinfo: Likewise. * manual/math.texi: Likewise. * manual/message.texi: Likewise. * manual/pattern.texi: Likewise. * manual/process.texi: Likewise. * manual/signal.texi: Likewise. * manual/socket.texi: Likewise. * manual/startup.texi: Likewise. * manual/stdio.texi: Likewise. * manual/terminal.texi: Likewise. * manual/examples/rprintf.c: Likewise. * manual/examples/testopt.c: Likewise. Patches by Zack Weinberg . 1998-03-19 20:45 Tim Waugh * posix/wordexp.c (parse_param): Don't immediately stop parsing a parameter name after seeing a digit if it's enclosed in braces. --- posix/wordexp.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'posix') diff --git a/posix/wordexp.c b/posix/wordexp.c index 268a0e8c86..1df552a66f 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -1220,10 +1220,9 @@ parse_param (char **word, size_t *word_length, size_t *max_length, continue; } - special = (strchr ("*@$", words[*offset]) != NULL - || isdigit (words[*offset])); + special = strchr ("*@$", words[*offset]) != NULL; - if (!isalpha (words[*offset]) && !special) + if (!isalnum (words[*offset]) && !special) /* Stop and evaluate, remembering char we stopped at */ break; @@ -1273,11 +1272,13 @@ envsubst: } /* Is it a special parameter? */ - if (strpbrk (env, "0123456789*@$")) + if (strpbrk (env, "*@$") || isdigit (*env)) { - if (env[1]) + if ((isdigit(*env) && strcspn (env, "1234567890")) || + (!isdigit(*env) && env[1] != '\0')) { - /* Bad substitution if there is more than one character */ + /* Bad substitution if it isn't "*", "@", "$", or just a number. */ + bad_subst: free (env); fprintf (stderr, "${%s}: bad substitution\n", env); return WRDE_SYNTAX; @@ -1286,7 +1287,11 @@ envsubst: /* Is it a digit? */ if (isdigit(*env)) { - int n = *env - '0'; + char *endp; + int n = strtol (env, &endp, 10); + + if (*endp != '\0') + goto bad_subst; free (env); if (n >= __libc_argc) -- cgit v1.2.3