Mercurial > illumos > illumos-gate
changeset 13854:095969cfa779
3260 linker is insufficiently careful with strtok
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Fri, 05 Oct 2012 16:48:45 -0400 |
parents | 93ee8890b568 |
children | 8fba982bba7d |
files | usr/src/cmd/sgs/packages/common/SUNWonld-README usr/src/cmd/sgs/rtld/common/cap.c usr/src/cmd/sgs/rtld/common/setup.c |
diffstat | 3 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README Sat Oct 13 10:17:57 2012 -0500 +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README Fri Oct 05 16:48:45 2012 -0400 @@ -1631,3 +1631,10 @@ ================================================================================ 308 ld may misalign sections only preceded by empty sections +1301 ld crashes with '-z ignore' due to a null data descriptor +1626 libld may accidentally return success while failing +2413 %ymm* need to be preserved on way through PLT +3210 ld should tolerate SHT_PROGBITS for .eh_frame sections on amd64 +3228 Want -zassert-deflib for ld +3230 ld.so.1 should check default paths for DT_DEPAUDIT +3260 linker is insufficiently careful with strtok
--- a/usr/src/cmd/sgs/rtld/common/cap.c Sat Oct 13 10:17:57 2012 -0500 +++ b/usr/src/cmd/sgs/rtld/common/cap.c Fri Oct 05 16:48:45 2012 -0400 @@ -858,8 +858,9 @@ if ((caps = strdup(str)) == NULL) return (0); - ptr = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next); - do { + for (ptr = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next); + ptr != NULL; + ptr = strtok_r(NULL, MSG_ORIG(MSG_CAP_DELIMIT), &next)) { Xword val = 0; /* @@ -947,8 +948,7 @@ cap_settings[ndx - 1].cs_val[mode] |= val; cap_settings[ndx - 1].cs_set[mode]++; - } while ((ptr = strtok_r(NULL, - MSG_ORIG(MSG_CAP_DELIMIT), &next)) != NULL); + } /* * If the "override" token was supplied, set the alternative @@ -982,8 +982,9 @@ if ((caps = strdup(str)) == NULL) return (0); - name = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next); - do { + for (name = strtok_r(caps, MSG_ORIG(MSG_CAP_DELIMIT), &next); + name != NULL; + name = strtok_r(NULL, MSG_ORIG(MSG_CAP_DELIMIT), &next)) { avl_index_t where; PathNode *pnp; uint_t hash = sgs_str_hash(name); @@ -999,8 +1000,7 @@ pnp->pn_hash = hash; avl_insert(capavl, pnp, where); } - } while ((name = strtok_r(NULL, - MSG_ORIG(MSG_CAP_DELIMIT), &next)) != NULL); + } return (1); }
--- a/usr/src/cmd/sgs/rtld/common/setup.c Sat Oct 13 10:17:57 2012 -0500 +++ b/usr/src/cmd/sgs/rtld/common/setup.c Fri Oct 05 16:48:45 2012 -0400 @@ -104,8 +104,10 @@ lddstub = (lmflags & LML_FLG_TRC_ENABLE) && (FLAGS1(*clmp) & FL1_RT_LDDSTUB); - ptr = strtok_r(objs, MSG_ORIG(MSG_STR_DELIMIT), &next); - do { + + for (ptr = strtok_r(objs, MSG_ORIG(MSG_STR_DELIMIT), &next); + ptr != NULL; + ptr = strtok_r(NULL, MSG_ORIG(MSG_STR_DELIMIT), &next)) { Rt_map *nlmp = NULL; uint_t flags; @@ -179,8 +181,7 @@ if (flags & FLG_RT_OBJINTPO) lml_main.lm_flags |= LML_FLG_INTRPOSE; - } while ((ptr = strtok_r(NULL, - MSG_ORIG(MSG_STR_DELIMIT), &next)) != NULL); + } free(palp); free(objs);