(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-radius.c) |
| |
| 1623 | | | static void register_attrs(gpointer k _U_, gpointer v, gpointer p) { |
| 1624 | | | radius_attr_info_t* a = v; |
| 1625 | | | int i; |
| 1626 | | | gint* ett = &(a->ett); |
| 1627 | | | gchar* abbrev = g_strconcat("radius.",a->name,NULL); |
| 1628 | | | hf_register_info hfri[] = { |
| 1629 | | | { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, |
| 1630 | | | { NULL, { NULL,NULL, FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}, |
| 1631 | | | { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, |
| 1632 | | | { NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }} |
| 1633 | | | }; |
| 1634 | | | guint len_hf = 2; |
| 1635 | | | hfett_t* ri = p; |
| 1636 | | | |
| 1637 | | | for(i=0; abbrev[i]; i++) { |
| 1638 | | | if(abbrev[i] == '-') abbrev[i] = '_'; |
| 1639 | | | if(abbrev[i] == '/') abbrev[i] = '_'; |
| 1640 | | | } |
| 1641 | | | |
| 1642 | | | hfri[0].p_id = &(a->hf); |
| 1643 | | | hfri[1].p_id = &(a->hf_len); |
| 1644 | | | |
| 1645 | | | hfri[0].hfinfo.name = a->name; |
| 1646 | | | hfri[0].hfinfo.abbrev = abbrev; |
| 1647 | | | |
| 1648 | | | hfri[1].hfinfo.name = "Length"; |
| 1649 | | | hfri[1].hfinfo.abbrev = g_strconcat(abbrev,".len",NULL); |
| 1650 | | | hfri[1].hfinfo.blurb = g_strconcat(a->name," Length",NULL); |
| 1651 | | | |
| 1652 | | | if (a->type == radius_integer) { |
| 1653 | | | hfri[0].hfinfo.type = FT_UINT32; |
| 1654 | | | hfri[0].hfinfo.display = BASE_DEC; |
| 1655 | | | |
| 1656 | | | hfri[2].p_id = &(a->hf64); |
| 1657 | | | hfri[2].hfinfo.name = g_strdup(a->name); |
| 1658 | | | hfri[2].hfinfo.abbrev = abbrev; |
| 1659 | | | hfri[2].hfinfo.type = FT_UINT64; |
| 1660 | | | hfri[2].hfinfo.display = BASE_DEC; |
| 1661 | | | |
| 1662 | | | if (a->vs) { |
| 1663 | | | hfri[0].hfinfo.strings = VALS(a->vs); |
| 1664 | | | } |
| 1665 | | | |
| 1666 | | | len_hf++; |
| 1667 | | | }else if (a->type == radius_signed) { |
| 1668 | | | hfri[0].hfinfo.type = FT_INT32; |
| 1669 | | | hfri[0].hfinfo.display = BASE_DEC; |
| 1670 | | | |
| 1671 | | | hfri[2].p_id = &(a->hf64); |
| 1672 | | | hfri[2].hfinfo.name = g_strdup(a->name); |
| 1673 | | | hfri[2].hfinfo.abbrev = abbrev; |
| 1674 | | | hfri[2].hfinfo.type = FT_INT64; |
| 1675 | | | hfri[2].hfinfo.display = BASE_DEC; |
| 1676 | | | |
| 1677 | | | if (a->vs) { |
| 1678 | | | hfri[0].hfinfo.strings = VALS(a->vs); |
| 1679 | | | } |
| 1680 | | | |
| 1681 | | | len_hf++; |
| 1682 | | | } else if (a->type == radius_string) { |
| 1683 | | | hfri[0].hfinfo.type = FT_STRING; |
| 1684 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1685 | | | } else if (a->type == radius_octets) { |
| 1686 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1687 | | | hfri[0].hfinfo.display = BASE_NONE; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 1688 | | | } else if (a->type == radius_ipaddr) { |
| 1689 | | | hfri[0].hfinfo.type = FT_IPv4; |
| 1690 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1691 | | | } else if (a->type == radius_ipv6addr) { |
| 1692 | | | hfri[0].hfinfo.type = FT_IPv6; |
| 1693 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1694 | | | } else if (a->type == radius_ipv6prefix) { |
| 1695 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1696 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1697 | | | } else if (a->type == radius_ipxnet) { |
| 1698 | | | hfri[0].hfinfo.type = FT_IPXNET; |
| 1699 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1700 | | | } else if (a->type == radius_date) { |
| 1701 | | | hfri[0].hfinfo.type = FT_ABSOLUTE_TIME; |
| 1702 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1703 | | | } else if (a->type == radius_abinary) { |
| 1704 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1705 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1706 | | | } else if (a->type == radius_ifid) { |
| 1707 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1708 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1709 | | | } else if (a->type == radius_combo_ip) { |
| 1710 | | | hfri[0].hfinfo.type = FT_IPv4; |
| 1711 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1712 | | | |
| 1713 | | | hfri[2].p_id = &(a->hf64); |
| 1714 | | | hfri[2].hfinfo.name = g_strdup(a->name); |
| 1715 | | | hfri[2].hfinfo.abbrev = g_strdup(abbrev); |
| 1716 | | | hfri[2].hfinfo.type = FT_IPv6; |
| 1717 | | | hfri[2].hfinfo.display = BASE_NONE; |
| 1718 | | | |
| 1719 | | | len_hf++; |
| 1720 | | | } else if (a->type == radius_tlv) { |
| 1721 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1722 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1723 | | | } else { |
| 1724 | | | hfri[0].hfinfo.type = FT_BYTES; |
| 1725 | | | hfri[0].hfinfo.display = BASE_NONE; |
| 1726 | | | } |
| 1727 | | | |
| 1728 | | | if (a->tagged) { |
| 1729 | | | hfri[len_hf].p_id = &(a->hf_tag); |
| 1730 | | | hfri[len_hf].hfinfo.name = "Tag"; |
| 1731 | | | hfri[len_hf].hfinfo.abbrev = g_strconcat(abbrev,".tag",NULL); |
| 1732 | | | hfri[len_hf].hfinfo.blurb = g_strconcat(a->name," Tag",NULL); |
| 1733 | | | hfri[len_hf].hfinfo.type = FT_UINT8; |
| 1734 | | | hfri[len_hf].hfinfo.display = BASE_HEX; |
| 1735 | | | len_hf++; |
| 1736 | | | } |
| 1737 | | | |
| 1738 | | | g_array_append_vals(ri->hf,hfri,len_hf); |
| 1739 | | | g_array_append_val(ri->ett,ett);
x /usr/include/glib-2.0/glib/garray.h |
| |
65 | #define g_array_append_val(a,v) g_array_append_vals (a, &(v), 1) |
| |
|
| 1740 | | | |
| 1741 | | | if (a->tlvs_by_id) { |
| 1742 | | | g_hash_table_foreach(a->tlvs_by_id,register_attrs,ri); |
| 1743 | | | } |
| 1744 | | | } |
| |