Print this page
10324 topo_usb_parse_port_type() gets value check wrong

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/topo/modules/common/usb/topo_usb_metadata.c
          +++ new/usr/src/lib/fm/topo/modules/common/usb/topo_usb_metadata.c
↓ open down ↓ 282 lines elided ↑ open up ↑
 283  283  topo_usb_parse_port_type(topo_mod_t *mod, topo_usb_parse_t *parse,
 284  284      const char *line)
 285  285  {
 286  286          unsigned long val;
 287  287          char *eptr;
 288  288  
 289  289          VERIFY3S(parse->tp_state, ==, TOPO_USB_P_PORT_TYPE);
 290  290  
 291  291          errno = 0;
 292  292          val = strtoul(line, &eptr, 0);
 293      -        if (errno != 0 || *eptr != '\0' || val > UINT_MAX) {
      293 +        if (errno != 0 || *eptr != '\0' || val >= UINT_MAX) {
 294  294                  topo_mod_dprintf(mod, "encountered bad value for port-type "
 295  295                      "line: %s", line);
 296  296                  return (B_FALSE);
 297  297          }
 298  298  
 299  299          parse->tp_cport->tmp_port_type = (uint_t)val;
 300  300  
 301  301          parse->tp_state = TOPO_USB_P_PORT;
 302  302          return (B_TRUE);
 303  303  }
↓ open down ↓ 168 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX