wireshark/asn1/h450-ros/h450-ros.cnf
Peter Wu f2b4daf400 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>
2014-07-06 23:00:40 +00:00

109 lines
2.6 KiB
INI

#.EXPORTS
ROS
#.OMIT_ASSIGNMENT
Priority
RejectProblem
#.TYPE_RENAME
Invoke/argument InvokeArgument
ReturnResult/result/result ResultArgument
#.FIELD_RENAME
Invoke/invokeId invokeIdConstrained
Reject/problem/invoke invokeProblem
Reject/problem/returnError returnErrorProblem
Reject/problem/returnResult returnResultProblem
ReturnResult/result/result resultArgument
#--- ROS ---
#.FN_HDR ROS
DISSECTOR_ASSERT(actx->rose_ctx);
rose_ctx_clean_data(actx->rose_ctx);
#.END
#--- Code ---
#.FN_PARS
Code VAL_PTR = &%(ACTX)s->rose_ctx->d.code
Code/local VAL_PTR = &%(ACTX)s->rose_ctx->d.code_local
Code/global FN_VARIANT = _str VAL_PTR = &%(ACTX)s->rose_ctx->d.code_global
#.FN_FTR Code
actx->rose_ctx->d.code_item = actx->created_item;
#.END
#--- Problem ---
#.FN_PARS
GeneralProblem VAL_PTR = &problem_val
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_const(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.FN_FTR InvokeProblem
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_const(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.FN_FTR ReturnErrorProblem
g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64);
problem_str[64-1] = '\0';
#.END
#--- INVOKE ---
# body is implemented manually as asn2wrs is not able to handle subtype constraint event passed through parameter
#.FN_BODY Invoke/invokeId
offset = dissect_per_constrained_integer(%(TVB)s, %(OFFSET)s, %(ACTX)s, %(TREE)s, %(HF_INDEX)s,
0U, 65535U, %(VAL_PTR)s, TRUE);
#.END
#.FIELD_ATTR
Invoke/argument TYPE = FT_BYTES DISPLAY = BASE_NONE
#.FN_PARS Invoke/argument
FN_VARIANT = _pdu
TYPE_REF_FN = argument_cb
#.END
#.INCLUDE ../ros/ros-inv.cnf
#--- RETURN RESULT ---
#.FIELD_ATTR
ReturnResult/result/result TYPE = FT_BYTES DISPLAY = BASE_NONE
#.FN_PARS ReturnResult/result/result
FN_VARIANT = _pdu
TYPE_REF_FN = result_cb
#.END
#.INCLUDE ../ros/ros-res.cnf
#--- RETURN ERROR ---
#.FIELD_ATTR
ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_NONE
#.FN_PARS ReturnError/parameter
FN_VARIANT = _pdu
TYPE_REF_FN = error_cb
#.END
#.INCLUDE ../ros/ros-err.cnf
#--- REJECT ---
#.INCLUDE ../ros/ros-rej.cnf