Skip to content

Commit

Permalink
Merge pull request #35 from monich/empty-string
Browse files Browse the repository at this point in the history
Handle empty header values
  • Loading branch information
monich committed May 2, 2014
2 parents 05654fe + b8a79da commit 2df5b06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mms-lib/src/mms_codec.c
Expand Up @@ -473,6 +473,13 @@ static const char *decode_text(struct wsp_header_iter *iter)
const unsigned char *p;
unsigned int l;

if (wsp_header_iter_get_val_type(iter) == WSP_VALUE_TYPE_LONG) {
if (iter->len == 0) /* The only way to encode an empty string */
return (char*)(iter->pdu + iter->pos - 1);

return NULL;
}

if (wsp_header_iter_get_val_type(iter) != WSP_VALUE_TYPE_TEXT)
return NULL;

Expand Down

0 comments on commit 2df5b06

Please sign in to comment.