aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nbns.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2008-06-25 09:12:35 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2008-06-25 09:12:35 +0000
commite0197aac9561f0908a3d2fb5a9e30f58514a6c4c (patch)
tree2f52b71c5dec33e0ee6a1b48d6420269ab845ee2 /epan/dissectors/packet-nbns.c
parentf698dd9c5ee1a592d8acbea2c48986817474bb9c (diff)
Constify a bunch of stuff, to squelch -Wwrite-strings warnings.
epan/dissectors/packet-ncp2222.inc is a bit hard to fix, so we're not ready to enable that warning by default yet. Throw in some casts to handle GLib routines that take arbitrary non-const pointers (they can later return the pointers, and some callers might want to modify or free up those pointers in cases where they're known to be writable or allocated). Use ep_tvb_memdup() rather than a combination of ep_alloc() and tvb_memcpy(). Clean up some indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25601 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-nbns.c')
-rw-r--r--epan/dissectors/packet-nbns.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c
index db85150b6d..aabeb6a515 100644
--- a/epan/dissectors/packet-nbns.c
+++ b/epan/dissectors/packet-nbns.c
@@ -277,14 +277,16 @@ get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset,
{
int name_len;
const char *name;
- char *nbname;
+ const char *nbname;
+ char *nbname_buf;
const char *pname;
char cname, cnbname;
int name_type;
char *pname_ret;
size_t index = 0;
- nbname=ep_alloc(NBNAME_BUF_LEN);
+ nbname_buf=ep_alloc(NBNAME_BUF_LEN);
+ nbname = nbname_buf;
name_len = get_dns_name(tvb, offset, nbns_data_offset, &name);
/* OK, now undo the first-level encoding. */
@@ -327,14 +329,14 @@ get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset,
/* Do we have room to store the character? */
if (index < NETBIOS_NAME_LEN) {
/* Yes - store the character. */
- nbname[index++] = cnbname;
+ nbname_buf[index++] = cnbname;
}
}
/* NetBIOS names are supposed to be exactly 16 bytes long. */
if (index != NETBIOS_NAME_LEN) {
/* It's not. */
- g_snprintf(nbname, NBNAME_BUF_LEN, "Illegal NetBIOS name (%lu bytes long)",
+ g_snprintf(nbname_buf, NBNAME_BUF_LEN, "Illegal NetBIOS name (%lu bytes long)",
(unsigned long)index);
goto bad;
}