diff options
| author | rillig <rillig@NetBSD.org> | 2021-04-10 22:40:34 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-04-10 22:40:34 +0000 |
| commit | 3d563a5bbd6f0f7d32f3ce55e3b714cc0f03e42e (patch) | |
| tree | ef6c2453390cce814ac40aa6f35315f0e1bb2653 /usr.bin/make | |
| parent | cc21fb3b4e82872d808daa8694167a5b0550515d (diff) | |
make: fix out-of-bounds read in Var_Parse_FastLane (since 30 minutes)
This bug made the test varmod-edge.mk fail sometimes with varying error
messages, as can be expected for an out-of-bounds read.
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/var.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 6909ccd9c23..6d9be555cb6 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.914 2021/04/10 22:35:02 rillig Exp $ */ +/* $NetBSD: var.c,v 1.915 2021/04/10 22:40:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -140,7 +140,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.914 2021/04/10 22:35:02 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.915 2021/04/10 22:40:34 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4401,7 +4401,8 @@ Var_Parse_FastLane(const char **pp, VarEvalMode emode, FStr *out_value) return false; p += 4; - while (*p != '$' && *p != '{' && *p != ':' && *p != '\\' && *p != '}') + while (*p != '$' && *p != '{' && *p != ':' && *p != '\\' && + *p != '}' && *p != '\0') p++; if (*p != '}') return false; |
