summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-10-05 13:45:47 +0000
committerPaul Smith <psmith@gnu.org>2002-10-05 13:45:47 +0000
commit47cd8d4624b60d3462991c436c961e0721cd278b (patch)
tree897bc298ea2cd924c12f029d6b699a2c7adaa84b /read.c
parentd1d9c0274bf49bac2cf5293caef54f474cced796 (diff)
downloadgunmake-47cd8d4624b60d3462991c436c961e0721cd278b.tar.gz
Fix core dump on malformed variable line (Debian bug #81656)
Allow SysV-style variable references to use {} in addition to (). Add variable.h to the POTFILES.in since it has a translatable string.
Diffstat (limited to 'read.c')
-rw-r--r--read.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/read.c b/read.c
index 9a4c609..07bb11a 100644
--- a/read.c
+++ b/read.c
@@ -1081,7 +1081,7 @@ eval (ebuf, set_default)
have_sysv_atvar = 0;
if (!posix_pedantic)
for (p = strchr (p2, '$'); p != 0; p = strchr (p+1, '$'))
- if (p[1] == '@' || (p[1] == '(' && p[2] == '@'))
+ if (p[1] == '@' || ((p[1] == '(' || p[1] == '{') && p[2] == '@'))
{
have_sysv_atvar = 1;
break;
@@ -1862,7 +1862,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
since we're just emulating a SysV function, and if we do that then
why not emulate it completely (that's what SysV make does: it
re-expands the entire prerequisite list, all the time, with $@
- etc. in scope. But, it would be a pain indeed to document this
+ etc. in scope). But, it would be a pain indeed to document this
("iff you use $$@, your prerequisite lists is expanded twice...")
Ouch. Maybe better to make the code more complex. */
@@ -1895,20 +1895,23 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
char *at;
int atlen;
- /* If it's a '$@' or '$(@', it's escaped */
+ /* If it's '$@', '$(@', or '${@', it's escaped */
if ((++p)[0] == '$'
- && (p[1] == '@' || (p[1] == '(' && p[2] == '@')))
+ && (p[1] == '@'
+ || ((p[1] == '(' || p[1] == '{') && p[2] == '@')))
{
bcopy (p, s, strlen (p)+1);
continue;
}
- /* Maybe found one. Check. p will point to '@' [for $@] or
- ')' [for $(@)] or 'D' [for $(@D)] or 'F' [for $(@F)]. */
- if (p[0] != '@'
- && (p[0] != '(' || (++p)[0] != '@'
- || ((++p)[0] != ')'
- && (p[1] != ')' || (p[0] != 'D' && p[0] != 'F')))))
+ /* Maybe found one. We like anything of any form matching @,
+ [({]@[}):], or [({]@[DF][}):]. */
+
+ if (! (p[0] == '@'
+ || ((p[0] == '(' || p[0] == '{') && (++p)[0] == '@'
+ && (((++p)[0] == ')' || p[0] == '}' || p[0] == ':')
+ || ((p[1] == ')' || p[1] == '}' || p[1] == ':')
+ && (p[0] == 'D' || p[0] == 'F'))))))
continue;
/* Found one. Compute the length and string ptr. Move p