aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nbns.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-06-25 09:12:35 +0000
committerGuy Harris <guy@alum.mit.edu>2008-06-25 09:12:35 +0000
commit83fc9d5e0952b79aa59f2676f73c54893c0c7a56 (patch)
tree2f52b71c5dec33e0ee6a1b48d6420269ab845ee2 /epan/dissectors/packet-nbns.c
parent044e57c91780795ada89b9a5cd50cf0f53eadfc2 (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. svn path=/trunk/; revision=25601
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;
}