summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-09-22 20:22:27 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commite8ce775db824de329b81293b4e5d8fbd65624528 (patch)
tree4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /parse.y
parentd166f048818e10cf3799aa24a174fb22835f1acc (diff)
downloadbash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y15
1 files changed, 12 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index f0e76595..a8d47805 100644
--- a/parse.y
+++ b/parse.y
@@ -2529,7 +2529,7 @@ read_token_word (character)
#if defined (ARRAY_VARS)
/* Identify possible compound array variable assignment. */
- else if (character == '=')
+ else if (character == '=' && token_index > 0)
{
peek_char = shell_getc (1);
if (peek_char == '(') /* ) */
@@ -3077,6 +3077,7 @@ decode_prompt_string (string)
{
/* Use the value of PWD because it is much more efficient. */
char t_string[PATH_MAX];
+ int tlen;
temp = get_string_value ("PWD");
@@ -3085,11 +3086,17 @@ decode_prompt_string (string)
if (getcwd (t_string, sizeof(t_string)) == 0)
{
t_string[0] = '.';
- t_string[1] = '\0';
+ tlen = 1;
}
+ else
+ tlen = strlen (t_string);
}
else
- strcpy (t_string, temp);
+ {
+ tlen = sizeof (t_string) - 1;
+ strncpy (t_string, temp, tlen);
+ }
+ t_string[tlen] = '\0';
if (c == 'W')
{
@@ -3098,6 +3105,8 @@ decode_prompt_string (string)
strcpy (t_string, t + 1);
}
else
+ /* polite_directory_format is guaranteed to return a string
+ no longer than PATH_MAX - 1 characters. */
strcpy (t_string, polite_directory_format (t_string));
/* If we're going to be expanding the prompt string later,