diff options
author | Jari Aalto <jari.aalto@cante.net> | 1997-09-22 20:22:27 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:51 +0000 |
commit | e8ce775db824de329b81293b4e5d8fbd65624528 (patch) | |
tree | 4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /parse.y | |
parent | d166f048818e10cf3799aa24a174fb22835f1acc (diff) | |
download | android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.bz2 android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.zip |
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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, |