diff options
author | Richard Lowe <richlowe@richlowe.net> | 2012-10-05 16:48:45 -0400 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2012-10-16 13:43:42 -0400 |
commit | cc4ec4394cda0c382f50cf9d771b6fcdeffa8c8d (patch) | |
tree | 1f6b1e3cba92a29df6fadea316af17cd8b764e4c /usr/src | |
parent | ace0359e9b3ac0b4bb7ddb51ae9138de3df33789 (diff) | |
download | illumos-joyent-cc4ec4394cda0c382f50cf9d771b6fcdeffa8c8d.tar.gz |
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>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sgs/packages/common/SUNWonld-README | 7 | ||||
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/cap.c | 16 | ||||
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/setup.c | 9 |
3 files changed, 20 insertions, 12 deletions
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 67c224ca95..a618c6f9d4 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1631,3 +1631,10 @@ Bugid Risk Synopsis ================================================================================ 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 diff --git a/usr/src/cmd/sgs/rtld/common/cap.c b/usr/src/cmd/sgs/rtld/common/cap.c index 93302468c9..d3c74c658e 100644 --- a/usr/src/cmd/sgs/rtld/common/cap.c +++ b/usr/src/cmd/sgs/rtld/common/cap.c @@ -858,8 +858,9 @@ cap_modify(Xword tag, const char *str) 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_modify(Xword tag, const char *str) 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 @@ cap_files(const char *str) 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 @@ cap_files(const char *str) pnp->pn_hash = hash; avl_insert(capavl, pnp, where); } - } while ((name = strtok_r(NULL, - MSG_ORIG(MSG_CAP_DELIMIT), &next)) != NULL); + } return (1); } diff --git a/usr/src/cmd/sgs/rtld/common/setup.c b/usr/src/cmd/sgs/rtld/common/setup.c index f1092a674f..c5d2a2671e 100644 --- a/usr/src/cmd/sgs/rtld/common/setup.c +++ b/usr/src/cmd/sgs/rtld/common/setup.c @@ -104,8 +104,10 @@ preload(const char *str, Rt_map *mlmp, Rt_map **clmp) 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 @@ preload(const char *str, Rt_map *mlmp, Rt_map **clmp) 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); |