From: Pekka Riikonen Date: Mon, 9 Sep 2002 09:01:04 +0000 (+0000) Subject: SilcAttributeObjMime does not include allocated buffer, but X-Git-Tag: silc.server.0.9.5~9 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=0d1349109b9f6677eb2f748c597540d1282f5329 SilcAttributeObjMime does not include allocated buffer, but const data from the payload. --- 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,