diff options
author | Jörg Mayer <jmayer@loplof.de> | 2006-01-20 21:18:18 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2006-01-20 21:18:18 +0000 |
commit | a052b3a98b5ddb839ad5c7bb22c8ed06cfca3f58 (patch) | |
tree | 016767623fc98e98b07e2c39e6ab1e27f4febf89 /epan/dissectors/packet-dcm.c | |
parent | 613d04a1ce869e9811eb13f4cf5a1a5b0bb5c632 (diff) |
packet-bgp.c: Fix incorrect use of g_snprintf return value
mp_addr_to_str was unnecessary 'complex' - simplified it
packet-dns.c: Fix incorrect use of g_snprintf return value
packet-dcm.c: Fix incorrect use of g_snprintf return value
Someone who understands the protocol should look at the
"vr, tr might be used uninitialized..." warning.
packet-x11.c: Fix incorrect use of g_snprintf return value
packet-kerberos.c: Fix incorrect use of g_snprintf return value
Someone should take a look at the
"longjump might clobber ..." messages
packet-diameter.c: Fix incorrect use of g_snprintf return value
Get rid of unsigned < 0 check
packet-pgm.c: Fix incorrect use of g_snprintf return value
packet-nbns.c: Fix incorrect use of g_snprintf return value
packet-winsrepl.c: Collateral damage to packet-nbns.c fix
packet-netbios.c: Collateral damage to packet-nbns.c fix
packet-netbios.h: Collateral damage to packet-nbns.c fix
packet-kerberos.c: Collateral damage to packet-nbns.c fix
packet-nbipx.c: Collateral damage to packet-nbns.c fix
svn path=/trunk/; revision=17065
Diffstat (limited to 'epan/dissectors/packet-dcm.c')
-rw-r--r-- | epan/dissectors/packet-dcm.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index e9601330fa..2a3845adc3 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -527,55 +527,64 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset, DISSECTOR_ASSERT(MAX_BUF_LEN > strlen(dtag->desc)); p=buf; - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), "%s", dtag->desc); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), "%s", dtag->desc)); if (vr > 0) { vval = tvb_format_text(tvb, vr, 2); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " [%s]", vval); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " [%s]", vval)); } switch (tr > 0 ? tr : dtag->dtype) { case DCM_TSTR: default: /* try ascii */ vval = tvb_format_text(tvb, offset, len); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " %s", vval); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " %s", vval)); break; case DCM_TINT2: if (DCM_ILE & syntax) val16 = tvb_get_letohs(tvb, offset); else val16 = tvb_get_ntohs(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x (%d)", val16, val16); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x (%d)", val16, val16)); break; case DCM_TINT4: if (DCM_ILE & syntax) val32 = tvb_get_letohl(tvb, offset); else val32 = tvb_get_ntohl(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x (%d)", val32, val32); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x (%d)", val32, val32)); break; case DCM_TFLT: { gfloat valf; if (DCM_ILE & syntax) valf = tvb_get_letohieee_float(tvb, offset); else valf = tvb_get_ntohieee_float(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " (%f)", valf); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " (%f)", valf)); } break; case DCM_TDBL: { gdouble vald; if (DCM_ILE & syntax) vald = tvb_get_letohieee_double(tvb, offset); else vald = tvb_get_ntohieee_double(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " (%f)", vald); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " (%f)", vald)); } break; case DCM_TSTAT: /* call dcm_rsp2str() on TINT2 */ if (DCM_ILE & syntax) val16 = tvb_get_letohs(tvb, offset); else val16 = tvb_get_ntohs(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x '%s'", val16, dcm_rsp2str(val16)); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x '%s'", val16, dcm_rsp2str(val16))); break; case DCM_TCMD: /* call dcm_cmd2str() on TINT2 */ if (DCM_ILE & syntax) val16 = tvb_get_letohs(tvb, offset); else val16 = tvb_get_ntohs(tvb, offset); - p+=g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x '%s'", val16, dcm_cmd2str(val16)); + p+=MIN(MAX_BUF_LEN-(p-buf), + g_snprintf(p, MAX_BUF_LEN-(p-buf), " 0x%x '%s'", val16, dcm_cmd2str(val16))); break; case DCM_SQ: /* Sequence */ case DCM_OTH: /* Other BYTE, WORD, ... */ |