(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-x11.c) |
| |
| 2063 | | | static void string16_with_buffer_preallocated(tvbuff_t *tvb, proto_tree *t, |
| 2064 | | | int hf, int hf_bytes, |
| 2065 | | | int offset, unsigned length, |
| 2066 | | | char **s, int *sLength, |
| 2067 | | | gboolean little_endian) |
| 2068 | | | { |
| 2069 | | | int truncated = FALSE; |
| 2070 | | | unsigned l = length / 2; |
| 2071 | | | |
| 2072 | | | if (stringIsActuallyAn8BitString(tvb, offset, l)) { |
| 2073 | | | char *dp; |
| 2074 | | | int soffset = offset; |
| 2075 | | | |
| 2076 | | | if (l > STRING16_MAX_DISPLAYED_LENGTH) { |
| 2077 | | | truncated = TRUE; |
| 2078 | | | l = STRING16_MAX_DISPLAYED_LENGTH; |
| 2079 | | | } |
| 2080 | | | if (*sLength < (int) l + 3) { |
| 2081 | | | *s = ep_alloc(l + 3); |
| 2082 | | | *sLength = l + 3; |
| 2083 | | | } |
| 2084 | | | dp = *s; |
| 2085 | | | *dp++ = '"'; |
| 2086 | | | if (truncated) l -= 3; |
| 2087 | | | |
| 2088 | | | while(l--) { |
| 2089 | | | soffset++; |
| 2090 | | | *dp++ = tvb_get_guint8(tvb, soffset); |
| 2091 | | | soffset++; |
| 2092 | | | } |
| 2093 | | | *dp++ = '"'; |
| 2094 | | | |
| 2095 | | | |
| 2096 | | | if (truncated) { *dp++ = '.'; *dp++ = '.'; *dp++ = '.'; } |
| 2097 | | | |
| 2098 | | | *dp++ = '\0'; |
Unused Value
The value assigned to dp is never subsequently used on any execution path. |
|
| 2099 | | | proto_tree_add_string_format(t, hf, tvb, offset, length, (gchar *)tvb_get_ptr(tvb, offset, length), "%s: %s", |
| 2100 | | | proto_registrar_get_nth(hf) -> name, *s); |
| 2101 | | | } else |
| 2102 | | | proto_tree_add_item(t, hf_bytes, tvb, offset, length, little_endian); |
| 2103 | | | |
| 2104 | | | } |
| |