Skip to content

Commit

Permalink
Fix wrong type of lumps.
Browse files Browse the repository at this point in the history
As the eoh (Enf Of Header) is determined during the on-demand parsing, the add_lump() may wrongly lable a lump as "header" or "body" (as the add_lump() may be used before the parsing reached the EOH).
So, better identify all headers asap, so the add_lump() will properly work all the time. This will not add any overhead, as in 99.9999% of the case, due the functions used in cfg, anyhow you end up parsing the whole message.

Fixes  #2144
This is a 100% safe fix, there are 0 chances for side effects.

(cherry picked from commit 23e098f)
  • Loading branch information
bogdan-iancu committed Jun 24, 2020
1 parent 69f1d9b commit 2ffd96f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser/msg_parser.c
Expand Up @@ -727,7 +727,7 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
ZSW(fl->u.request.uri.s));
LM_DBG(" version: <%.*s>\n",fl->u.request.version.len,
ZSW(fl->u.request.version.s));
flags=HDR_VIA_F;
flags=HDR_EOH_F;
break;
case SIP_REPLY:
LM_DBG("SIP Reply (status):\n");
Expand All @@ -737,7 +737,7 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
ZSW(fl->u.reply.status.s));
LM_DBG(" reason: <%.*s>\n", fl->u.reply.reason.len,
ZSW(fl->u.reply.reason.s));
flags=HDR_VIA_F;
flags=HDR_EOH_F;
break;
default:
LM_DBG("unknown type %d\n",fl->type);
Expand Down

0 comments on commit 2ffd96f

Please sign in to comment.