SilcAttributeObjMime does not include allocated buffer, but
authorPekka Riikonen <priikone@silcnet.org>
Mon, 9 Sep 2002 09:01:04 +0000 (09:01 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 9 Sep 2002 09:01:04 +0000 (09:01 +0000)
const data from the payload.

lib/silccore/silcattrs.c
lib/silccore/silcattrs.h

index 652333e35c63ed963699541b9393db412d602ba7..9359bf8b222e35ad9276b67c412c84301ae62dad 100644 (file)
@@ -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;
     }
index 3038c34fc29c698a5564b4e275edb991922afe0d..f03dc7f4d0a6484845a0d8ce5f14487f6cfec1a7 100644 (file)
@@ -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,