Ethereal-dev: [Ethereal-dev] Bug in asn2eth - not properly handling .FN_BODY with "%s" in it?
sahlberg@xxxxxxxxxxxx wrote:
User: sahlberg
Date: 2005/10/15 05:46 PM
Log:
remove some strcpy() calls
Directory: /trunk/asn1/acse/
Changes Path Action
+1 -1 acse.cnf Modified
That change replaced
strcpy(object_identifier_id, oid);
with
g_snprintf(object_identifier_id, MAX_OID_STR_LEN, "%s", oid);
inside the #.FN_BODY EXTERNAL/indirect-reference section.
Unfortunately, it appears that asn2eth turned that into
g_snprintf(object_identifier_id, MAX_OID_STR_LEN, "{'DEFAULT_BODY': '
offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset,
hf_index,\n NULL);\n', 'VAL_PTR':
'NULL', 'TREE': 'tree', 'FN_VARIANT': '', 'HF_INDEX': 'hf_index',
'PINFO': 'pinfo', 'CREATED_ITEM_PTR': 'NULL', 'OFFSET': 'offset',
'TNAME': 'T_indirect_reference', 'ER': 'ber', 'IMPLICIT_TAG':
'implicit_tag', 'TVB': 'tvb'}", oid);
which presumably isn't what's intended, and which generates warnings
from the compiler.
The "eth_type_fn_body" method does
if pars:
out = out % pars
which means that if out contains any "%" characters, they'll be treated
as introducing a printf-like format sequence, and substitution will be done.
Does this mean that it's unsafe to use any printf-like procedure calls
inside #.FN_BODY sections? If so, that should either be documented
(complete with a workaround!), or fixed.