Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mms_codec] Encode the Name parameter as Text-string
According to Table 38 "Well-Known Parameter Assignments" in WAP-230-WSP spec.
  • Loading branch information
monich committed Oct 6, 2014
1 parent 37e6840 commit e6a001f
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions mms-lib/src/mms_codec.c
Expand Up @@ -1846,25 +1846,6 @@ static gboolean encode_utf8_string(struct file_buffer *fb,
return TRUE;
}

static gboolean encode_quoted_string(struct file_buffer *fb,
enum mms_header header, void *user)
{
char *ptr;
char **text = user;

if (!*text)
return TRUE;

ptr = fb_request_field(fb, header, strlen(*text) + 2);
if (ptr == NULL)
return FALSE;

ptr[0] = '"';
strcpy(ptr + 1, *text);

return TRUE;
}

static gboolean encode_content_id(struct file_buffer *fb,
enum mms_header header, void *user)
{
Expand Down Expand Up @@ -2130,8 +2111,10 @@ static gboolean mms_encode_send_req_part_header(struct mms_attachment *part,
len += cs_len;

} else if (g_ascii_strcasecmp("name", key) == 0) {
/* text-string */
name = parsed[i+1];
len += 2 + strlen(name) + 1;
len += 2 + strlen(name);
if (name[0] & 0x80) len++;
}
}

Expand Down Expand Up @@ -2202,7 +2185,7 @@ static gboolean mms_encode_send_req_part_header(struct mms_attachment *part,

/* Encode "name" param */
if (name) {
if (encode_quoted_string(fb, WSP_PARAMETER_TYPE_NAME_DEFUNCT,
if (encode_text(fb, WSP_PARAMETER_TYPE_NAME_DEFUNCT,
&name) == FALSE)
goto done;
}
Expand Down

0 comments on commit e6a001f

Please sign in to comment.