mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
Fix BZ #18043 (c4): buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param
This commit is contained in:
parent
95f386609f
commit
5f85a4bf94
@ -1,3 +1,9 @@
|
||||
2015-03-09 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||
|
||||
[BZ #18043]
|
||||
* posix/wordexp.c (parse_param): Fix buffer overflow.
|
||||
* posix/wordexp-test.c (test_case): Add test case.
|
||||
|
||||
2015-03-09 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||
|
||||
[BZ #18042]
|
||||
|
@ -234,8 +234,9 @@ struct test_case_struct
|
||||
{ WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
|
||||
{ WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
|
||||
|
||||
{ WRDE_SYNTAX, NULL, "`\\", 0, 0, { NULL, }, IFS }, /* BZ 18042 */
|
||||
{ WRDE_SYNTAX, NULL, "${", 0, 0, { NULL, }, IFS }, /* BZ 18043 */
|
||||
{ WRDE_SYNTAX, NULL, "`\\", 0, 0, { NULL, }, IFS }, /* BZ 18042 */
|
||||
{ WRDE_SYNTAX, NULL, "${", 0, 0, { NULL, }, IFS }, /* BZ 18043 */
|
||||
{ WRDE_SYNTAX, NULL, "L${a:", 0, 0, { NULL, }, IFS }, /* BZ 18043#c4 */
|
||||
|
||||
{ -1, NULL, NULL, 0, 0, { NULL, }, IFS },
|
||||
};
|
||||
|
@ -1343,7 +1343,8 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
|
||||
break;
|
||||
|
||||
case ':':
|
||||
if (strchr ("-=?+", words[1 + *offset]) == NULL)
|
||||
if (words[1 + *offset] == '\0'
|
||||
|| strchr ("-=?+", words[1 + *offset]) == NULL)
|
||||
goto syntax;
|
||||
|
||||
colon_seen = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user