diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-07-27 11:36:04 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-07-27 11:36:04 +0000 |
commit | fc6fcec253a3d0fc1807a3c4cb39ab54cc8afa2f (patch) | |
tree | b13d7c23dd0ea7afc32f4f9127ac27690f75524c | |
parent | d103e8b98085dbb5f7707242723b9d3ce74f2723 (diff) | |
parent | 67c3092ccd4e8c261df7eded9df072ff9c4e330b (diff) | |
download | illumos-joyent-fc6fcec253a3d0fc1807a3c4cb39ab54cc8afa2f.tar.gz |
[illumos-gate merge]
commit 67c3092ccd4e8c261df7eded9df072ff9c4e330b
7214 make buffer under-read while parsing conditional variables
-rw-r--r-- | usr/src/cmd/make/bin/doname.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr/src/cmd/make/bin/doname.cc b/usr/src/cmd/make/bin/doname.cc index 730403ac55..85be203973 100644 --- a/usr/src/cmd/make/bin/doname.cc +++ b/usr/src/cmd/make/bin/doname.cc @@ -21,6 +21,8 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2016 RackTop Systems. */ /* @@ -2893,8 +2895,12 @@ add_pattern_conditionals(register Name target) pattern = wcb1.get_string(); if (pattern[1] != 0) { percent = (wchar_t *) wcschr(pattern, (int) percent_char); + /* Check for possible buffer under-read */ + if ((length = wcb.length()-wcslen(percent+1)) <= 0) { + continue; + } if (!wcb.equaln(pattern, percent-pattern) || - !IS_WEQUAL(wcb.get_string(wcb.length()-wcslen(percent+1)), percent+1)) { + !IS_WEQUAL(wcb.get_string(length), percent+1)) { continue; } } |