From 2a37658ba79e72f430b09c5e4676ebfa1b8881d1 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Mon, 23 Jul 2012 13:45:07 +0000 Subject: [PATCH] - fix coverity 10086 --- src/mesh/mesh_api.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index f29ebe9d2..935c99574 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -1419,12 +1419,16 @@ GNUNET_MESH_announce_regex (struct GNUNET_MESH_Handle *h, msgsize = sizeof(struct GNUNET_MessageHeader) + len; GNUNET_assert (UINT16_MAX > msgsize); - msg = GNUNET_malloc (msgsize); - msg->size = htons (msgsize); - msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX); - memcpy (&msg[1], regex, len); + { + char buffer[msgsize]; - send_packet(h, msg, NULL); + msg = (struct GNUNET_MessageHeader *) buffer; + msg->size = htons (msgsize); + msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX); + memcpy (&msg[1], regex, len); + + send_packet(h, msg, NULL); + } } /** -- 2.25.1