aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-epl.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2018-02-02 20:44:39 +0100
committerRoland Knall <rknall@gmail.com>2018-02-02 20:31:10 +0000
commitf244742b46af8ec402761dee9240e25c2856cb77 (patch)
tree745be220e0be329080e49d8055ce19d4c18d5af4 /epan/dissectors/packet-epl.c
parentd8565d8f1b8bf9653e0ff8847b72765861eff5c2 (diff)
epl: fix map.title memleak.
Valgrind report: ==642== 14 bytes in 1 blocks are definitely lost in loss record 5,705 of 49,814 ==642== by 0xA966DCC: g_strdup_vprintf (gstrfuncs.c:507) ==642== by 0xA966E88: g_strdup_printf (gstrfuncs.c:533) ==642== by 0x6D523F4: dissect_object_mapping (packet-epl.c:4216) ==642== by 0x6D56394: dissect_epl_sdo_command (packet-epl.c:3862) ==642== by 0x6D56394: dissect_epl_asnd_sdo (packet-epl.c:3572) ==642== by 0x6D59BC5: dissect_epl_asnd (packet-epl.c:3053) ==642== by 0x6D59BC5: dissect_eplpdu.part.21 (packet-epl.c:2627) Found by oss-fuzz/5907. Change-Id: I6f4d2cea761581260af396c848ab1fded5641b44 Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5907 Reviewed-on: https://code.wireshark.org/review/25573 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-epl.c')
-rw-r--r--epan/dissectors/packet-epl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c
index c11f84509c..c4f34e3d1e 100644
--- a/epan/dissectors/packet-epl.c
+++ b/epan/dissectors/packet-epl.c
@@ -1331,9 +1331,9 @@ struct object_mapping {
} frame; /* frames for which object_mapping applies */
struct od_entry *info;
const char *index_name;
- const char *title;
+ char title[32];
};
-#define OBJECT_MAPPING_INITIALIZER { { 0, 0 }, { 0, 0 }, 0, 0, 0, { 0, 0 }, 0, 0, 0 }
+#define OBJECT_MAPPING_INITIALIZER { { 0, 0 }, { 0, 0 }, 0, 0, 0, { 0, 0 }, 0, 0, { 0 } }
#define CONVO_FOR_RESPONSE 1
#define CONVO_FOR_REQUEST 2
@@ -4211,9 +4211,9 @@ dissect_object_mapping(struct profile *profile, wmem_array_t *mappings, proto_tr
{
/* TODO One could think of a better string here? */
if (nosub)
- map.title = g_strdup_printf("PDO - %04X", map.pdo.idx);
+ g_snprintf(map.title, sizeof(map.title), "PDO - %04X", map.pdo.idx);
else
- map.title = g_strdup_printf("PDO - %04X:%02X", map.pdo.idx, map.pdo.subindex);
+ g_snprintf(map.title, sizeof(map.title), "PDO - %04X:%02X", map.pdo.idx, map.pdo.subindex);
add_object_mapping(mappings, &map);
}