From 0d1349109b9f6677eb2f748c597540d1282f5329 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 9 Sep 2002 09:01:04 +0000 Subject: [PATCH] SilcAttributeObjMime does not include allocated buffer, but const data from the payload. --- lib/silccore/silcattrs.c | 2 +- lib/silccore/silcattrs.h | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/silccore/silcattrs.c b/lib/silccore/silcattrs.c index 652333e3..9359bf8b 100644 --- a/lib/silccore/silcattrs.c +++ b/lib/silccore/silcattrs.c @@ -312,7 +312,7 @@ bool silc_attribute_get_object(SilcAttributePayload payload, SilcAttributeObjMime *mime = *object; if (object_size != sizeof(*mime)) break; - mime->mime = silc_memdup(payload->data, payload->data_len); + mime->mime = (const unsigned char *)payload->data; mime->mime_len = payload->data_len; ret = TRUE; } diff --git a/lib/silccore/silcattrs.h b/lib/silccore/silcattrs.h index 3038c34f..f03dc7f4 100644 --- a/lib/silccore/silcattrs.h +++ b/lib/silccore/silcattrs.h @@ -189,6 +189,7 @@ typedef enum { * * Parses one attribute payload sent as argument and saves it to * SilcAttributePayload context. The new allocated context is returned. + * ***/ SilcAttributePayload silc_attribute_payload_parse(const unsigned char *payload, @@ -354,14 +355,14 @@ typedef struct { * * DESCRIPTION * - * Data type for MIME object as attribute. Caller must free the - * MIME data buffer inside the structure. + * Data type for MIME object as attribute. The data in the structure + * is valid as long as the payload structure is valid. * * SOURCE */ typedef struct { - unsigned char *mime; /* allocated MIME buffer */ - SilcUInt32 mime_len; /* length of the allocated MIME buffer */ + const unsigned char *mime; /* MIME buffer */ + SilcUInt32 mime_len; /* length of the MIME buffer */ } SilcAttributeObjMime; /***/ @@ -448,7 +449,7 @@ typedef struct { * Returns TRUE if the `attribute' attribute was found and FALSE * if such attribute is not present in the `payload', or the `object_size' * is not sufficient. See the definition of SilcAttribute for the - * list attributes and the required object types for attributes. + * list of attributes and the required object types for attributes. * ***/ bool silc_attribute_get_object(SilcAttributePayload payload, -- 2.24.0