diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
commit | 8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch) | |
tree | ad4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /epan/dissectors/packet-pcnfsd.c | |
parent | 8ede6b7dc09aa636f87147ab432a137c209e8aca (diff) |
Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().
Change some data types to avoid those implicit conversion warnings.
When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.
Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers. Cast
away those warnings in some cases where an API we don't control forces
us to do so.
Enable a bunch of additional warnings by default. Note why at least
some of the other warnings aren't enabled.
randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.
If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.
svn path=/trunk/; revision=46748
Diffstat (limited to 'epan/dissectors/packet-pcnfsd.c')
-rw-r--r-- | epan/dissectors/packet-pcnfsd.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/epan/dissectors/packet-pcnfsd.c b/epan/dissectors/packet-pcnfsd.c index 1fb73533b4..fab3dd0d81 100644 --- a/epan/dissectors/packet-pcnfsd.c +++ b/epan/dissectors/packet-pcnfsd.c @@ -170,12 +170,18 @@ dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, } /* "NFS Illustrated 14.7.13 */ -static void -pcnfsd_decode_obscure(char* data, int len) +static char * +pcnfsd_decode_obscure(const char* data, int len) { - for ( ; len>0 ; len--, data++) { - *data = (*data ^ 0x5b) & 0x7f; + char *decoded_buf; + char *decoded_data; + + decoded_buf = ep_alloc(len); + decoded_data = decoded_buf; + for ( ; len>0 ; len--, data++, decoded_data++) { + *decoded_data = (*data ^ 0x5b) & 0x7f; } + return decoded_buf; } @@ -185,10 +191,11 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { int newoffset; - char *ident = NULL; + const char *ident = NULL; + const char *ident_decoded; proto_item *ident_item = NULL; proto_tree *ident_tree = NULL; - char *password = NULL; + const char *password = NULL; proto_item *password_item = NULL; proto_tree *password_tree = NULL; @@ -210,13 +217,15 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, if (ident) { /* Only attempt to decode the ident if it has been specified */ - if (strcmp(ident, RPC_STRING_EMPTY)) - pcnfsd_decode_obscure(ident, (int)strlen(ident)); + if (strcmp(ident, RPC_STRING_EMPTY) != 0) + ident_decoded = pcnfsd_decode_obscure(ident, (int)strlen(ident)); + else + ident_decoded = ident; if (ident_tree) proto_tree_add_string(ident_tree, hf_pcnfsd_auth_ident_clear, - tvb, offset+4, (gint)strlen(ident), ident); + tvb, offset+4, (gint)strlen(ident_decoded), ident_decoded); } if (ident_item) { proto_item_set_text(ident_item, "Authentication Ident: %s", |