aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-07-06 15:34:38 +0200
committerEvan Huus <eapache@gmail.com>2014-07-06 23:00:40 +0000
commitf2b4daf4005d60eef7e34e2e6ebf4fe487d3c255 (patch)
tree1fac15d7bcbc381c5e0a3a6602e7edd20e574e39
parentec6a22dc3ba8e2d438b34d892d6a40e1be2a28f2 (diff)
Add printf-format annotations, fix garbage
The WRETH dissector showed up some garbage in the column display. Upon further inspection, it turns out that the format string had a trailing percent sign which caused (unsigned)-1 to be returned by g_printf_string_upper_bound (in emem_strdup_vprintf). Then ep_alloc is called with (unsigned)-1 + 1 = 0 memory, no wonder that garbage shows up. ASAN could not even catch this error because EP is in charge of this. So, start adding G_GNUC_PRINTF annotations in each header that uses the "fmt" or "format" paramters (grepped + awk). This revealed some other errors. The NCP2222 dissector was missing a format string (not a security vuln though). Many dissectors used val_to_str with a constant (but empty) string, these have been replaced by val_to_str_const. ASN.1 dissectors were regenerated for this. Minor: the mate plugin used "%X" instead of "%p" for a pointer type. The ncp2222 dissector and wimax plugin gained modelines. Change-Id: I7f3f6a3136116f9b251719830a39a7b21646f622 Reviewed-on: https://code.wireshark.org/review/2881 Reviewed-by: Evan Huus <eapache@gmail.com>
-rw-r--r--asn1/h450-ros/h450-ros.cnf8
-rw-r--r--asn1/q932-ros/q932-ros.cnf8
-rw-r--r--asn1/x509if/x509if.cnf6
-rw-r--r--echld/echld-int.h2
-rw-r--r--echld/echld.h4
-rw-r--r--epan/dfilter/dfilter-int.h2
-rw-r--r--epan/dfilter/grammar.lemon4
-rw-r--r--epan/dfilter/semcheck.c10
-rw-r--r--epan/diam_dict.l2
-rw-r--r--epan/dissectors/packet-dis.c2
-rw-r--r--epan/dissectors/packet-h450-ros.c8
-rw-r--r--epan/dissectors/packet-lisp.c8
-rw-r--r--epan/dissectors/packet-ncp2222.inc14
-rw-r--r--epan/dissectors/packet-q932-ros.c8
-rw-r--r--epan/dissectors/packet-wreth.c2
-rw-r--r--epan/dissectors/packet-x509if.c6
-rw-r--r--epan/dissectors/packet-zbee-aps.c2
-rw-r--r--epan/emem.h5
-rw-r--r--epan/except.h3
-rw-r--r--epan/proto.h3
-rw-r--r--epan/ptvcursor.h3
-rw-r--r--epan/to_str.h2
-rw-r--r--epan/value_string.h15
-rw-r--r--plugins/mate/mate_runtime.c2
-rw-r--r--plugins/mate/mate_util.h6
-rw-r--r--plugins/wimax/msg_arq.c14
-rw-r--r--plugins/wimaxasncp/wimaxasncp_dict.l2
-rw-r--r--wsutil/unicode-utils.h3
28 files changed, 97 insertions, 57 deletions
diff --git a/asn1/h450-ros/h450-ros.cnf b/asn1/h450-ros/h450-ros.cnf
index 480759c7dc..9915c20117 100644
--- a/asn1/h450-ros/h450-ros.cnf
+++ b/asn1/h450-ros/h450-ros.cnf
@@ -47,16 +47,16 @@ InvokeProblem VAL_PTR = &problem_val
ReturnResultProblem VAL_PTR = &problem_val
ReturnErrorProblem VAL_PTR = &problem_val
#.FN_FTR GeneralProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.FN_FTR InvokeProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_InvokeProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_InvokeProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.FN_FTR ReturnResultProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.FN_FTR ReturnErrorProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.END
diff --git a/asn1/q932-ros/q932-ros.cnf b/asn1/q932-ros/q932-ros.cnf
index be575dd0be..4ad7c7397e 100644
--- a/asn1/q932-ros/q932-ros.cnf
+++ b/asn1/q932-ros/q932-ros.cnf
@@ -50,13 +50,13 @@ InvokeProblem VAL_PTR = &problem_val
ReturnResultProblem VAL_PTR = &problem_val
ReturnErrorProblem VAL_PTR = &problem_val
#.FN_FTR GeneralProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64);
#.FN_FTR InvokeProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64);
#.FN_FTR ReturnResultProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64);
#.FN_FTR ReturnErrorProblem
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64);
#.END
#--- INVOKE ---
diff --git a/asn1/x509if/x509if.cnf b/asn1/x509if/x509if.cnf
index ab4b47a147..d54bdaf295 100644
--- a/asn1/x509if/x509if.cnf
+++ b/asn1/x509if/x509if.cnf
@@ -208,7 +208,7 @@ DistinguishedName B "2.16.840.1.101.2.2.1.188" "id-at-primaryMember"
proto_item_append_text(tree, " (%%s)", name);
}
- if((fmt = val_to_str(hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
last_ava = (char *)wmem_alloc(wmem_packet_scope(), MAX_AVA_STR_LEN); *last_ava = '\0';
register_frame_end_routine (actx->pinfo, x509if_frame_end);
@@ -251,7 +251,7 @@ DistinguishedName B "2.16.840.1.101.2.2.1.188" "id-at-primaryMember"
proto_item_append_text(tree, "%%s)", value);
}
- if((fmt = val_to_str(ava_hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(ava_hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
if (!last_ava) {
@@ -384,7 +384,7 @@ DistinguishedName B "2.16.840.1.101.2.2.1.188" "id-at-primaryMember"
proto_item_append_text(top_of_dn, " (%%s)", last_dn);
/* see if we should append this to the col info */
- if((fmt = val_to_str(hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s%%s", fmt, last_dn);
}
diff --git a/echld/echld-int.h b/echld/echld-int.h
index acf5557a97..8bbd1f9a14 100644
--- a/echld/echld-int.h
+++ b/echld/echld-int.h
@@ -167,7 +167,7 @@ extern echld_bool_t paramset_apply_set (param_t* paramsets, char* name, char* va
extern echld_bool_t paramset_apply_em(param_t* paramset, enc_msg_t* em, char** err);
#define PARAM_LIST_FMT "%s(%s): %s\n" /* name, rw|ro|wo, desc */
-char* paramset_get_params_list(param_t* paramsets,const char* fmt);
+char* paramset_get_params_list(param_t* paramsets, const char* fmt) G_GNUC_PRINTF(2, 0);
#define PARAM_STR(Name, Default) static char* param_ ## Name = Default; \
static char* param_get_ ## Name (char** err _U_ ) { return (param_ ## Name) ? g_strdup(param_ ## Name) : (*err = g_strdup( #Name " not set"), NULL); } \
diff --git a/echld/echld.h b/echld/echld.h
index ff341705bc..5c224a088b 100644
--- a/echld/echld.h
+++ b/echld/echld.h
@@ -188,7 +188,9 @@ WS_DLL_PUBLIC enc_msg_t* echld_new_child_params_merge(enc_msg_t*, enc_msg_t*);
#define ECHLD_NC_PARAMS_FMT " %s='%s',\n" /* param='value' */
/* truncate takes off last N chars from the last item's fmt or prefix on empty */
-WS_DLL_PUBLIC char* echld_new_child_params_str(enc_msg_t* em, const char* prefix, const char* postfix, int truncate, const char* fmt);
+WS_DLL_PUBLIC char* echld_new_child_params_str(enc_msg_t* em,
+ const char* prefix, const char* postfix, int truncate, const char* fmt)
+ G_GNUC_FORMAT(5, 0);
/* create a new worker process */
diff --git a/epan/dfilter/dfilter-int.h b/epan/dfilter/dfilter-int.h
index 1b1018e7ad..8a7511de05 100644
--- a/epan/dfilter/dfilter-int.h
+++ b/epan/dfilter/dfilter-int.h
@@ -68,7 +68,7 @@ extern stnode_t *df_lval;
/* Set dfilter_error_msg_buf and dfilter_error_msg */
void
-dfilter_fail(const char *format, ...);
+dfilter_fail(const char *format, ...) G_GNUC_PRINTF(1, 2);
void
DfilterTrace(FILE *TraceFILE, char *zTracePrompt);
diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon
index 84803cd393..a9856127e6 100644
--- a/epan/dfilter/grammar.lemon
+++ b/epan/dfilter/grammar.lemon
@@ -81,11 +81,11 @@ any "error" symbols are shifted, if possible. */
break;
case STTYPE_STRING:
dfilter_fail("The string \"%s\" was unexpected in this context.",
- stnode_data(TOKEN));
+ (char *)stnode_data(TOKEN));
break;
case STTYPE_UNPARSED:
dfilter_fail("\"%s\" was unexpected in this context.",
- stnode_data(TOKEN));
+ (char *)stnode_data(TOKEN));
break;
case STTYPE_INTEGER:
dfilter_fail("The integer %d was unexpected in this context.",
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index c76859dc28..8e1d9b5bf6 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -358,7 +358,7 @@ check_exists(stnode_t *st_arg1)
case STTYPE_STRING:
case STTYPE_UNPARSED:
dfilter_fail("\"%s\" is neither a field nor a protocol name.",
- stnode_data(st_arg1));
+ (char *)stnode_data(st_arg1));
THROW(TypeError);
break;
@@ -730,8 +730,8 @@ check_relation_LHS_STRING(const char* relation_string,
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED) {
/* Well now that's silly... */
dfilter_fail("Neither \"%s\" nor \"%s\" are field or protocol names.",
- stnode_data(st_arg1),
- stnode_data(st_arg2));
+ (char *)stnode_data(st_arg1),
+ (char *)stnode_data(st_arg2));
THROW(TypeError);
}
else if (type2 == STTYPE_RANGE) {
@@ -819,8 +819,8 @@ check_relation_LHS_UNPARSED(const char* relation_string,
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED) {
/* Well now that's silly... */
dfilter_fail("Neither \"%s\" nor \"%s\" are field or protocol names.",
- stnode_data(st_arg1),
- stnode_data(st_arg2));
+ (char *)stnode_data(st_arg1),
+ (char *)stnode_data(st_arg2));
THROW(TypeError);
}
else if (type2 == STTYPE_RANGE) {
diff --git a/epan/diam_dict.l b/epan/diam_dict.l
index 9615582681..730c02652c 100644
--- a/epan/diam_dict.l
+++ b/epan/diam_dict.l
@@ -111,7 +111,7 @@ static ddict_xmlpi_t* last_xmlpi;
static char** attr_str;
static unsigned* attr_uint;
-static void ddict_debug(const char* fmt, ...);
+static void ddict_debug(const char* fmt, ...) G_GNUC_PRINTF(1, 2);
static void append_to_buffer(const char* txt, unsigned len);
static FILE* ddict_open(const char*, const char*);
diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c
index 2e1aa051b1..4a9723eed2 100644
--- a/epan/dissectors/packet-dis.c
+++ b/epan/dissectors/packet-dis.c
@@ -5125,7 +5125,7 @@ static int dissect_DIS_PARSER_SIGNAL_PDU(tvbuff_t *tvb, packet_info *pinfo, prot
offset = parse_DIS_FIELDS_SIGNAL_LINK16_NETWORK_HEADER(tvb, tree, offset, &messageType);
ti = proto_tree_add_text(tree, tvb, offset, -1, "Link 16 Message Data: %s",
- val_to_str(messageType, DIS_PDU_Link16_MessageType_Strings, ""));
+ val_to_str_const(messageType, DIS_PDU_Link16_MessageType_Strings, ""));
sub_tree = proto_item_add_subtree(ti, ett_dis_signal_link16_message_data);
offset = parse_Link16_Message_Data(sub_tree, tvb, offset, pinfo, encodingScheme, messageType);
proto_item_set_end(ti, tvb, offset);
diff --git a/epan/dissectors/packet-h450-ros.c b/epan/dissectors/packet-h450-ros.c
index 3a3dee4676..b12841ae30 100644
--- a/epan/dissectors/packet-h450-ros.c
+++ b/epan/dissectors/packet-h450-ros.c
@@ -422,7 +422,7 @@ dissect_h450_ros_GeneralProblem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, &problem_val);
#line 50 "../../asn1/h450-ros/h450-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64);
problem_str[64-1] = '\0';
return offset;
@@ -447,7 +447,7 @@ dissect_h450_ros_InvokeProblem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac
offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, &problem_val);
#line 53 "../../asn1/h450-ros/h450-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_InvokeProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_InvokeProblem_vals), ""), 64);
problem_str[64-1] = '\0';
return offset;
@@ -467,7 +467,7 @@ dissect_h450_ros_ReturnResultProblem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx
offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, &problem_val);
#line 56 "../../asn1/h450-ros/h450-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64);
problem_str[64-1] = '\0';
return offset;
@@ -489,7 +489,7 @@ dissect_h450_ros_ReturnErrorProblem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_
offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, &problem_val);
#line 59 "../../asn1/h450-ros/h450-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64);
problem_str[64-1] = '\0';
return offset;
diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c
index 3c87d277d8..4f8781ae2b 100644
--- a/epan/dissectors/packet-lisp.c
+++ b/epan/dissectors/packet-lisp.c
@@ -1019,9 +1019,9 @@ dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
offset += 1;
proto_item_append_text(ti_lat, ": %s %d\302\260 %d' %d\"",
- val_to_str(north, lat_typevals, ""), deg, min, sec);
+ val_to_str_const(north, lat_typevals, ""), deg, min, sec);
proto_item_append_text(tir, ": (%s%d\302\260%d'%d\"",
- val_to_str(north, lat_typevals, ""), deg, min, sec);
+ val_to_str_const(north, lat_typevals, ""), deg, min, sec);
/* PROCESS LONGITUDE */
@@ -1056,9 +1056,9 @@ dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
offset += 1;
proto_item_append_text(ti_lon, ": %s %d\302\260 %d' %d\"",
- val_to_str(east, lon_typevals, ""), deg, min, sec);
+ val_to_str_const(east, lon_typevals, ""), deg, min, sec);
proto_item_append_text(tir, ", %s%d\302\260%d'%d\")",
- val_to_str(east, lon_typevals, ""), deg, min, sec);
+ val_to_str_const(east, lon_typevals, ""), deg, min, sec);
/* PROCESS ALTITUDE */
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc
index 7fdc4fe714..352d9545c0 100644
--- a/epan/dissectors/packet-ncp2222.inc
+++ b/epan/dissectors/packet-ncp2222.inc
@@ -2855,6 +2855,7 @@ trap_for_expert_event(proto_tree *ncp_tree, packet_info *pinfo, const ncp_record
}
expert_add_info_format(pinfo, NULL, &ei_ncp_file_rights,
+ "Op-lock open, mode %s for filename %s with rights %s",
val_to_str((guint32)(strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"),
p_filename,
val_to_str((atoi(p_rights) & 0x5f), ncp_rights_vals, "Unknown: %d"));
@@ -12062,3 +12063,16 @@ dissect_ping_req(tvbuff_t *tvb, packet_info *pinfo,
CLEANUP_CALL_AND_POP;
}
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=4 expandtab filetype=c:
+ * :indentSize=4:tabSize=4:noTabs=true:
+ */
diff --git a/epan/dissectors/packet-q932-ros.c b/epan/dissectors/packet-q932-ros.c
index 59a37a30eb..861278e5c2 100644
--- a/epan/dissectors/packet-q932-ros.c
+++ b/epan/dissectors/packet-q932-ros.c
@@ -507,7 +507,7 @@ dissect_q932_ros_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
&problem_val);
#line 53 "../../asn1/q932-ros/q932-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64);
return offset;
}
@@ -532,7 +532,7 @@ dissect_q932_ros_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
&problem_val);
#line 55 "../../asn1/q932-ros/q932-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64);
return offset;
}
@@ -552,7 +552,7 @@ dissect_q932_ros_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U
&problem_val);
#line 57 "../../asn1/q932-ros/q932-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64);
return offset;
}
@@ -574,7 +574,7 @@ dissect_q932_ros_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
&problem_val);
#line 59 "../../asn1/q932-ros/q932-ros.cnf"
- g_strlcpy(problem_str, val_to_str(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64);
+ g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64);
return offset;
}
diff --git a/epan/dissectors/packet-wreth.c b/epan/dissectors/packet-wreth.c
index 5ab4bfe2a4..4bca480227 100644
--- a/epan/dissectors/packet-wreth.c
+++ b/epan/dissectors/packet-wreth.c
@@ -1182,7 +1182,7 @@ gint WrethMailDissection(tvbuff_t *tvb, guint8 Offset, packet_info * pInfo, prot
col_add_fstr(pInfo->cinfo, COL_INFO, "Mail : Codef = Ox%X (%s), Status = %02d (%s), Card = %d, Chan = %d" ,
Codef,
- val_to_str_ext(Codef, &tabCodef_ext, "Unknown 0x%04x%"),
+ val_to_str_ext(Codef, &tabCodef_ext, "Unknown 0x%04x"),
Status,
val_to_str_ext(Status, &tabStatus_ext, "Unknown %d"),
Card,
diff --git a/epan/dissectors/packet-x509if.c b/epan/dissectors/packet-x509if.c
index fe6cae6de4..487794506c 100644
--- a/epan/dissectors/packet-x509if.c
+++ b/epan/dissectors/packet-x509if.c
@@ -744,7 +744,7 @@ dissect_x509if_T_type_02(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
proto_item_append_text(tree, " (%s)", name);
}
- if((fmt = val_to_str(hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
last_ava = (char *)wmem_alloc(wmem_packet_scope(), MAX_AVA_STR_LEN); *last_ava = '\0';
register_frame_end_routine (actx->pinfo, x509if_frame_end);
@@ -796,7 +796,7 @@ dissect_x509if_T_atadv_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
proto_item_append_text(tree, "%s)", value);
}
- if((fmt = val_to_str(ava_hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(ava_hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
if (!last_ava) {
@@ -985,7 +985,7 @@ dissect_x509if_RDNSequence(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
proto_item_append_text(top_of_dn, " (%s)", last_dn);
/* see if we should append this to the col info */
- if((fmt = val_to_str(hf_index, fmt_vals, "")) && *fmt) {
+ if((fmt = val_to_str_const(hf_index, fmt_vals, "")) && *fmt) {
/* we have a format */
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s%s", fmt, last_dn);
}
diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c
index 0feeaa6b1b..8f7e053221 100644
--- a/epan/dissectors/packet-zbee-aps.c
+++ b/epan/dissectors/packet-zbee-aps.c
@@ -853,7 +853,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* Display the profile ID now that the source endpoint was listed. */
if (packet.type == ZBEE_APS_FCF_DATA) {
col_append_fstr(pinfo->cinfo, COL_PROTOCOL, " %s",
- rval_to_str(packet.profile, zbee_aps_apid_abbrs, ""));
+ rval_to_str_const(packet.profile, zbee_aps_apid_abbrs, ""));
}
/* Jump here if there is no endpoint addressing in this frame. */
diff --git a/epan/emem.h b/epan/emem.h
index 0ce3b20478..0e41294a61 100644
--- a/epan/emem.h
+++ b/epan/emem.h
@@ -75,10 +75,11 @@ void* ep_memdup(const void* src, size_t len) G_GNUC_MALLOC;
/** Create a formatted string with a packet lifetime scope */
WS_DLL_PUBLIC
-gchar* ep_strdup_vprintf(const gchar* fmt, va_list ap) G_GNUC_MALLOC;
+gchar* ep_strdup_vprintf(const gchar* fmt, va_list ap)
+ G_GNUC_MALLOC G_GNUC_PRINTF(1, 0);
WS_DLL_PUBLIC
gchar* ep_strdup_printf(const gchar* fmt, ...)
- G_GNUC_MALLOC G_GNUC_PRINTF(1, 2);
+ G_GNUC_MALLOC G_GNUC_PRINTF(1, 2);
WS_DLL_PUBLIC
gchar *ep_strconcat(const gchar *string, ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
diff --git a/epan/except.h b/epan/except.h
index 8db5acb7c5..063218274a 100644
--- a/epan/except.h
+++ b/epan/except.h
@@ -95,7 +95,8 @@ WS_DLL_PUBLIC void except_deinit(void);
WS_DLL_PUBLIC WS_MSVC_NORETURN void except_rethrow(except_t *) G_GNUC_NORETURN;
WS_DLL_PUBLIC WS_MSVC_NORETURN void except_throw(long, long, const char *) G_GNUC_NORETURN;
WS_DLL_PUBLIC WS_MSVC_NORETURN void except_throwd(long, long, const char *, void *) G_GNUC_NORETURN;
-WS_DLL_PUBLIC WS_MSVC_NORETURN void except_throwf(long, long, const char *, ...) G_GNUC_NORETURN;
+WS_DLL_PUBLIC WS_MSVC_NORETURN void except_throwf(long, long, const char *, ...)
+ G_GNUC_NORETURN G_GNUC_PRINTF(3, 4);
WS_DLL_PUBLIC void (*except_unhandled_catcher(void (*)(except_t *)))(except_t *);
extern unsigned long except_code(except_t *);
extern unsigned long except_group(except_t *);
diff --git a/epan/proto.h b/epan/proto.h
index c3a5ab38ea..8f6bc9f178 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -877,7 +877,8 @@ proto_tree_add_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, co
@return the newly created item */
proto_item *
proto_tree_add_text_valist(proto_tree *tree, tvbuff_t *tvb, gint start,
- gint length, const char *format, va_list ap);
+ gint length, const char *format, va_list ap)
+ G_GNUC_PRINTF(5, 0);
/** Add a text-only node that creates a subtree underneath.
proto_tree_add_text + proto_item_add_subtree
diff --git a/epan/ptvcursor.h b/epan/ptvcursor.h
index 55663f332d..ad85c312a3 100644
--- a/epan/ptvcursor.h
+++ b/epan/ptvcursor.h
@@ -111,7 +111,8 @@ ptvcursor_add_with_subtree(ptvcursor_t* ptvc, int hfindex, gint length,
WS_DLL_PUBLIC
proto_tree*
ptvcursor_add_text_with_subtree(ptvcursor_t* ptvc, gint length,
- gint ett_subtree, const char* format, ...);
+ gint ett_subtree, const char* format, ...)
+ G_GNUC_PRINTF(4, 5);
/* Creates a subtree and adds it to the cursor as the working tree but does not
* save the old working tree */
diff --git a/epan/to_str.h b/epan/to_str.h
index 9b3880c342..6d180dba44 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -99,7 +99,7 @@ WS_DLL_PUBLIC char *other_decode_bitfield_value(char *buf, const guint32 val, co
WS_DLL_PUBLIC char *decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
const int width);
WS_DLL_PUBLIC const char *decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width,
- const char *fmt);
+ const char *fmt) G_GNUC_PRINTF(4, 0);
WS_DLL_PUBLIC const gchar* port_type_to_str (port_type type);
diff --git a/epan/value_string.h b/epan/value_string.h
index d62c2d7951..c7b57f9a89 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -113,7 +113,8 @@ enum { \
WS_DLL_PUBLIC
const gchar *
-val_to_str(const guint32 val, const value_string *vs, const char *fmt);
+val_to_str(const guint32 val, const value_string *vs, const char *fmt)
+G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
const gchar *
@@ -136,7 +137,8 @@ typedef struct _val64_string {
WS_DLL_PUBLIC
const gchar *
-val64_to_str(const guint64 val, const val64_string *vs, const char *fmt);
+val64_to_str(const guint64 val, const val64_string *vs, const char *fmt)
+G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
const gchar *
@@ -193,7 +195,8 @@ value_string_ext_free(const value_string_ext *vse);
WS_DLL_PUBLIC
const gchar *
-val_to_str_ext(const guint32 val, const value_string_ext *vs, const char *fmt);
+val_to_str_ext(const guint32 val, const value_string_ext *vs, const char *fmt)
+G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
const gchar *
@@ -216,7 +219,8 @@ typedef struct _string_string {
WS_DLL_PUBLIC
const gchar *
-str_to_str(const gchar *val, const string_string *vs, const char *fmt);
+str_to_str(const gchar *val, const string_string *vs, const char *fmt)
+G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
const gchar *
@@ -236,7 +240,8 @@ typedef struct _range_string {
WS_DLL_PUBLIC
const gchar *
-rval_to_str(const guint32 val, const range_string *rs, const char *fmt);
+rval_to_str(const guint32 val, const range_string *rs, const char *fmt)
+G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
const gchar *
diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c
index 5f8e42d82f..7951d2bec4 100644
--- a/plugins/mate/mate_runtime.c
+++ b/plugins/mate/mate_runtime.c
@@ -210,7 +210,7 @@ static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, gchar* key) {
}
static void adopt_gop(mate_gog* gog, mate_gop* gop) {
- dbg_print (dbg_gog,5,dbg_facility,"adopt_gop: gog=%X gop=%X",gog,gop);
+ dbg_print (dbg_gog,5,dbg_facility,"adopt_gop: gog=%p gop=%p",gog,gop);
gop->gog = gog;
gop->next = NULL;
diff --git a/plugins/mate/mate_util.h b/plugins/mate/mate_util.h
index 89a7f3b2a0..9387c4437a 100644
--- a/plugins/mate/mate_util.h
+++ b/plugins/mate/mate_util.h
@@ -36,7 +36,8 @@
/******* dbg_print *********/
#define DEBUG_BUFFER_SIZE 4096
-extern void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... );
+extern void dbg_print(const gint* which, gint how, FILE* where,
+ const gchar* fmt, ... ) G_GNUC_PRINTF(4, 5);
/******* single copy strings *********/
@@ -49,7 +50,8 @@ typedef struct _scs_collection SCS_collection;
extern gchar* scs_subscribe(SCS_collection* collection, const gchar* s);
extern void scs_unsubscribe(SCS_collection* collection, gchar* s);
-extern gchar* scs_subscribe_printf(SCS_collection* collection, gchar* fmt, ...);
+extern gchar* scs_subscribe_printf(SCS_collection* collection, gchar* fmt, ...)
+ G_GNUC_PRINTF(2, 3);
/******* AVPs & Co. *********/
diff --git a/plugins/wimax/msg_arq.c b/plugins/wimax/msg_arq.c
index c7d538b259..50d6a86dc6 100644
--- a/plugins/wimax/msg_arq.c
+++ b/plugins/wimax/msg_arq.c
@@ -339,7 +339,7 @@ static void dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info
arq_fb_item = proto_tree_add_protocol_format(arq_feedback_tree, proto_mac_mgmt_msg_arq_decoder, tvb, offset, tvb_len, "ARQ_Feedback_IE");
proto_item_append_text(arq_fb_item, ", CID: %u, %s ARQ feedback IE, %s, BSN: %u",
- arq_cid, arq_last ? "Last" : "More", val_to_str(arq_ack_type, vals_arq_ack_type, ""), arq_bsn);
+ arq_cid, arq_last ? "Last" : "More", val_to_str_const(arq_ack_type, vals_arq_ack_type, ""), arq_bsn);
if (arq_ack_type != ARQ_CUMULATIVE_ACK_ENTRY) {
proto_item_append_text(arq_fb_item, ", %u ACK Map(s)", arq_num_ack_maps);
}
@@ -442,3 +442,15 @@ proto_reg_handoff_mac_mgmt_msg_arq(void)
dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_RESET, arq_handle);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/plugins/wimaxasncp/wimaxasncp_dict.l b/plugins/wimaxasncp/wimaxasncp_dict.l
index a643275453..4c37f74bd8 100644
--- a/plugins/wimaxasncp/wimaxasncp_dict.l
+++ b/plugins/wimaxasncp/wimaxasncp_dict.l
@@ -112,7 +112,7 @@ static gint16 *attr_uint16;
static guint wimaxasncp_bits(guint bits, char *n);
static gint wimaxasncp_decode_type(const gchar *name);
-static void wimaxasncp_dict_debug(const gchar *fmt, ...);
+static void wimaxasncp_dict_debug(const gchar *fmt, ...) G_GNUC_PRINTF(1, 2);
static void append_to_buffer(const gchar *txt, int len);
static FILE *wimaxasncp_dict_open(const gchar*, const gchar*);
diff --git a/wsutil/unicode-utils.h b/wsutil/unicode-utils.h
index 6f23de4909..2674a6ca8f 100644
--- a/wsutil/unicode-utils.h
+++ b/wsutil/unicode-utils.h
@@ -59,7 +59,8 @@ wchar_t * utf_8to16(const char *utf8str);
* @param fmt A standard g_printf() format string
*/
WS_DLL_PUBLIC
-void utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt, ...);
+void utf_8to16_snprintf(TCHAR *utf16buf, gint utf16buf_len, const gchar* fmt,
+ ...) G_GNUC_PRINTF(3, 4);
/** Given a UTF-16 string, convert it to UTF-8. This is meant to be used
* to convert between GTK+ 2.x (UTF-8) to Windows (UTF-16).