(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/reassemble.c) |
| |
| 995 | | | fragment_data * |
| 996 | | | fragment_add_check(tvbuff_t *tvb, int offset, packet_info *pinfo, |
| 997 | | | guint32 id, GHashTable *fragment_table, |
| 998 | | | GHashTable *reassembled_table, guint32 frag_offset, |
| 999 | | | guint32 frag_data_len, gboolean more_frags) |
| 1000 | | | { |
| 1001 | | | reassembled_key reass_key; |
| 1002 | | | fragment_key key, *new_key, *old_key; |
| 1003 | | | gpointer orig_key, value; |
| 1004 | | | fragment_data *fd_head; |
| 1005 | | | |
| 1006 | | | |
| 1007 | | | |
| 1008 | | | |
| 1009 | | | |
| 1010 | | | if (pinfo->fd->flags.visited) { |
| 1011 | | | reass_key.frame = pinfo->fd->num; |
| 1012 | | | reass_key.id = id; |
| 1013 | | | return g_hash_table_lookup(reassembled_table, &reass_key); |
| 1014 | | | } |
| 1015 | | | |
| 1016 | | | |
| 1017 | | | key.src = pinfo->src; |
| 1018 | | | key.dst = pinfo->dst; |
| 1019 | | | key.id = id; |
| 1020 | | | |
| 1021 | | | if (!g_hash_table_lookup_extended(fragment_table, &key, |
| 1022 | | | &orig_key, &value)) { |
| 1023 | | | |
| 1024 | | | |
| 1025 | | | |
| 1026 | | | fd_head = new_head(0); |
| 1027 | | | |
| 1028 | | | |
| 1029 | | | |
| 1030 | | | |
| 1031 | | | |
| 1032 | | | |
| 1033 | | | |
| 1034 | | | new_key = g_mem_chunk_alloc(fragment_key_chunk); |
| 1035 | | | COPY_ADDRESS(&new_key->src, &key.src);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/address.h |
| |
107 | #define COPY_ADDRESS(to, from) { \ |
108 | guint8 *COPY_ADDRESS_data; \ |
109 | (to)->type = (from)->type; \ |
110 | (to)->len = (from)->len; \ |
111 | COPY_ADDRESS_data = g_malloc((from)->len); \ |
112 | memcpy(COPY_ADDRESS_data, (from)->data, (from)->len); \ |
113 | (to)->data = COPY_ADDRESS_data; \ |
114 | } |
| |
|
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 1036 | | | COPY_ADDRESS(&new_key->dst, &key.dst);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/address.h |
| |
107 | #define COPY_ADDRESS(to, from) { \ |
108 | guint8 *COPY_ADDRESS_data; \ |
109 | (to)->type = (from)->type; \ |
110 | (to)->len = (from)->len; \ |
111 | COPY_ADDRESS_data = g_malloc((from)->len); \ |
112 | memcpy(COPY_ADDRESS_data, (from)->data, (from)->len); \ |
113 | (to)->data = COPY_ADDRESS_data; \ |
114 | } |
| |
|
| 1037 | | | new_key->id = key.id; |
| 1038 | | | g_hash_table_insert(fragment_table, new_key, fd_head); |
| 1039 | | | |
| 1040 | | | orig_key = new_key; |
| 1041 | | | } else { |
| 1042 | | | |
| 1043 | | | |
| 1044 | | | |
| 1045 | | | fd_head = value; |
| 1046 | | | } |
| 1047 | | | |
| 1048 | | | |
| 1049 | | | |
| 1050 | | | |
| 1051 | | | |
| 1052 | | | if (tvb_reported_length(tvb) > tvb_length(tvb)) |
| 1053 | | | return NULL; |
| 1054 | | | |
| 1055 | | | if (fragment_add_work(fd_head, tvb, offset, pinfo, frag_offset, |
| 1056 | | | frag_data_len, more_frags)) { |
| 1057 | | | |
| 1058 | | | |
| 1059 | | | |
| 1060 | | | |
| 1061 | | | |
| 1062 | | | |
| 1063 | | | |
| 1064 | | | |
| 1065 | | | |
| 1066 | | | |
| 1067 | | | |
| 1068 | | | old_key = orig_key; |
| 1069 | | | fragment_unhash(fragment_table, old_key); |
| 1070 | | | |
| 1071 | | | |
| 1072 | | | |
| 1073 | | | |
| 1074 | | | fragment_reassembled(fd_head, pinfo, reassembled_table, id); |
| 1075 | | | return fd_head; |
| 1076 | | | } else { |
| 1077 | | | |
| 1078 | | | |
| 1079 | | | |
| 1080 | | | return NULL; |
| 1081 | | | } |
| 1082 | | | } |
| |