Commit 1e14eeaf authored by Pekka Pessi's avatar Pekka Pessi

msg: fix problem in msg_multipart_parse()

The payload structure containing multiparty preamble had incorrect
length.
parent 25a9c058
...@@ -372,7 +372,7 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home, ...@@ -372,7 +372,7 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
msg_multipart_t *mp = NULL, *all = NULL, **mmp = &all; msg_multipart_t *mp = NULL, *all = NULL, **mmp = &all;
/* Dummy msg object */ /* Dummy msg object */
msg_t msg[1] = {{{ SU_HOME_INIT(msg) }}}; msg_t msg[1] = {{{ SU_HOME_INIT(msg) }}};
size_t len, m, blen; size_t len, m, blen, prelen;
char *boundary, *p, *next, save; char *boundary, *p, *next, save;
char const *b, *end; char const *b, *end;
msg_param_t param; msg_param_t param;
...@@ -413,6 +413,8 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home, ...@@ -413,6 +413,8 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
return NULL; return NULL;
} }
prelen = b - pl->pl_data;
/* Split multipart into parts */ /* Split multipart into parts */
for (;;) { for (;;) {
while (p[0] == ' ') while (p[0] == ' ')
...@@ -540,7 +542,8 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home, ...@@ -540,7 +542,8 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
} }
msg_fragment_clear(pl->pl_common); msg_fragment_clear(pl->pl_common);
pl->pl_len = all->mp_data - (char *)pl->pl_data;
pl->pl_len = prelen;
su_home_move(home, msg_home(msg)); su_home_deinit(msg_home(msg)); su_home_move(home, msg_home(msg)); su_home_deinit(msg_home(msg));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment