diff options
author | sjg <sjg@FreeBSD.org> | 2015-11-26 00:26:23 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-11-26 00:26:23 +0000 |
commit | 175e2b18f645026c3605e522d17209c2456e49ad (patch) | |
tree | abc448be3e2e020f76e46703f26eb6c0bb327924 /contrib/bmake | |
parent | 00cd225d9551dd20d8d693531d49451b5cd95e6a (diff) | |
download | FreeBSD-src-175e2b18f645026c3605e522d17209c2456e49ad.zip FreeBSD-src-175e2b18f645026c3605e522d17209c2456e49ad.tar.gz |
ParseTrackInput: do not access beyond end of buffer.
Reviewed by: dim
Diffstat (limited to 'contrib/bmake')
-rw-r--r-- | contrib/bmake/parse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c index 1718470..71735cb 100644 --- a/contrib/bmake/parse.c +++ b/contrib/bmake/parse.c @@ -2390,15 +2390,19 @@ static void ParseTrackInput(const char *name) { char *old; + char *ep; char *fp = NULL; size_t name_len = strlen(name); old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp); if (old) { + ep = old + strlen(old) - name_len; /* does it contain name? */ for (; old != NULL; old = strchr(old, ' ')) { if (*old == ' ') old++; + if (old >= ep) + break; /* cannot contain name */ if (memcmp(old, name, name_len) == 0 && (old[name_len] == 0 || old[name_len] == ' ')) goto cleanup; |