diff options
author | JINMEI, Tatuya <jinmei@isl.rdc.toshiba.co.jp> | 2007-06-14 05:18:29 +0000 |
---|---|---|
committer | JINMEI, Tatuya <jinmei@isl.rdc.toshiba.co.jp> | 2007-06-14 05:18:29 +0000 |
commit | b71c0e7cd83f41cdf8ccdf9ad6436061139fa8fc (patch) | |
tree | d59798582b9b6ba5f139415cc1fff47e157cc1c8 | |
parent | f59e15559d3be8167e451f134fa3dea46db50e67 (diff) |
dhcp6_get_options(): made sure the option argument to dhcp6_add_listval()
is converted to an integer (not u_int16).
Reported by: Shunichi Gondo
-rw-r--r-- | common.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1485,8 +1485,8 @@ dhcp6_get_options(p, ep, optinfo) struct dhcp6_optinfo *optinfo; { struct dhcp6opt *np, opth; - int i, opt, optlen, reqopts; - u_int16_t num; + int i, opt, optlen, reqopts, num; + u_int16_t num16; char *bp, *cp, *val; u_int16_t val16; u_int32_t val32; @@ -1548,14 +1548,14 @@ dhcp6_get_options(p, ep, optinfo) if (optlen < sizeof(u_int16_t)) goto malformed; memcpy(&val16, cp, sizeof(val16)); - num = ntohs(val16); + num16 = ntohs(val16); dprintf(LOG_DEBUG, "", " status code: %s", - dhcp6_stcodestr(num)); + dhcp6_stcodestr(num16)); /* need to check duplication? */ if (dhcp6_add_listval(&optinfo->stcode_list, - DHCP6_LISTVAL_STCODE, &num, NULL) == NULL) { + DHCP6_LISTVAL_STCODE, &num16, NULL) == NULL) { dprintf(LOG_ERR, FNAME, "failed to copy " "status code"); goto fail; @@ -1571,7 +1571,7 @@ dhcp6_get_options(p, ep, optinfo) u_int16_t opttype; memcpy(&opttype, val, sizeof(u_int16_t)); - num = ntohs(opttype); + num = (int)ntohs(opttype); dprintf(LOG_DEBUG, "", " requested option: %s", |