aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-17 17:40:39 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-17 17:40:39 +0000
commit488690121208fb26e6f87cdbbf9bf540fa4a7140 (patch)
tree80c2fc36abc3489c1e8809fd87458be0e358fe71 /posix
parent3c20b9b6a527397cf32fb013c86b1e4b5c422dc0 (diff)
downloadglibc-488690121208fb26e6f87cdbbf9bf540fa4a7140.tar
glibc-488690121208fb26e6f87cdbbf9bf540fa4a7140.tar.gz
glibc-488690121208fb26e6f87cdbbf9bf540fa4a7140.tar.bz2
glibc-488690121208fb26e6f87cdbbf9bf540fa4a7140.zip
Update.
1998-03-17 Ulrich Drepper <drepper@cygnus.com> * posix/wordexp.c (parse_param): Fix off-by-on error in $@ handling. Optimize a bit.
Diffstat (limited to 'posix')
-rw-r--r--posix/wordexp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 54f830cc2c..51cdc93df5 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1366,17 +1366,21 @@ envsubst:
if (*word == NULL)
return WRDE_NOSPACE;
- for (p = 1; __libc_argv[p]; p++)
+ for (p = 2; __libc_argv[p]; p++)
{
+ size_t len;
+ char *s;
if (w_addword (pwordexp, *word))
return WRDE_NOSPACE;
- *word = __strdup (__libc_argv[p]);
- *max_length = *word_length = strlen (*word);
- if (*word == NULL)
+ len = strlen (__libc_argv[p]) + 1;
+ s = malloc (len);
+ if (s == NULL)
return WRDE_NOSPACE;
+ *word = memcpy (s, __libc_argv[p], len);
+ *max_length = *word_length = len;
}
}
-
+
return 0;
}