aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-01-14 20:17:13 +0000
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-01-14 20:17:13 +0000
commit7d32872c518440ed97025f8eefcbf023131458f0 (patch)
treea63997b0d63831b837ee1e6dd62cd1639fe77a14 /epan/dissectors
parent52655a528abb5f082efe2f9e517ac3076955c959 (diff)
As pointed out by Sebastien Tandel a buffer is allocated unconditionally when it might not be necessary.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20427 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-ip.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 9b07720b14..14f1fabafa 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -690,13 +690,11 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
opt_len_type len_type;
unsigned int optlen;
const char *name;
-#define NAME_STR_LEN 7+1+1+2+2+1+1 /* "Unknown (0x%02x)" */
- char *name_str;
+ char *name_str = NULL;
void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *,
int, guint, packet_info *, proto_tree *);
guint len;
- name_str=ep_alloc(NAME_STR_LEN);
while (length > 0) {
opt = tvb_get_guint8(tvb, offset);
for (optp = &opttab[0]; optp < &opttab[nopts]; optp++) {
@@ -711,7 +709,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
optp = NULL; /* indicate that we don't know this option */
len_type = VARIABLE_LENGTH;
optlen = 2;
- g_snprintf(name_str, NAME_STR_LEN, "Unknown (0x%02x)", opt);
+ name_str = ep_strdup_printf("Unknown (0x%02x)", opt);
name = name_str;
dissect = NULL;
} else {