From e333e4c90f0aca41b0a56cef22fd80d0b0e73e14 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 17 Jan 2015 14:11:29 -0500 Subject: Convert OID APIs to use wmem. There are a few oid functions that are only called in oids_test.c. I'll presume the APIs are used in proprietary dissectors rather than just remove them. Change-Id: I4595e00f93bf9ab8cf2493fe0432b91960f55a3f Reviewed-on: https://code.wireshark.org/review/6592 Petri-Dish: Michael Mann Reviewed-by: Evan Huus Reviewed-by: Guy Harris Reviewed-by: Michael Mann --- epan/ftypes/ftype-bytes.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'epan/ftypes') diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index fc42f0c9f0..0669071ed3 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -97,7 +97,7 @@ oid_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_) static void oid_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf) { - const char* oid_str = oid_encoded2string(fv->value.bytes->data,fv->value.bytes->len); + char* oid_str = oid_encoded2string(NULL, fv->value.bytes->data,fv->value.bytes->len); /* * XXX: * I'm assuming that oid_repr_len is going to be called before to set buf's size. @@ -105,7 +105,8 @@ oid_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf) * I guess that is why this callback is not passed a length. * -- lego */ - strncpy(buf,oid_str,OID_REPR_LEN(fv)); + g_strlcpy(buf,oid_str,OID_REPR_LEN(fv)); + wmem_free(NULL, oid_str); } static int @@ -117,7 +118,7 @@ rel_oid_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_) static void rel_oid_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf) { - const char* oid_str = rel_oid_encoded2string(fv->value.bytes->data,fv->value.bytes->len); + char* oid_str = rel_oid_encoded2string(NULL, fv->value.bytes->data,fv->value.bytes->len); /* * XXX: * I'm assuming that oid_repr_len is going to be called before to set buf's size. @@ -126,7 +127,8 @@ rel_oid_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *b * -- lego */ *buf++ = '.'; - strncpy(buf,oid_str,REL_OID_REPR_LEN(fv)); + g_strlcpy(buf,oid_str,REL_OID_REPR_LEN(fv)); + wmem_free(NULL, oid_str); } static void -- cgit v1.2.3