blob: ec9acb4259f0ff0aa6293ac9a37c6bec491e7f51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
diff -up sofia-sip-1.12.11/libsofia-sip-ua/msg/msg_parser.c.orig sofia-sip-1.12.11/libsofia-sip-ua/msg/msg_parser.c
--- sofia-sip-1.12.11/libsofia-sip-ua/msg/msg_parser.c.orig 2011-03-11 07:49:18.000000000 -0700
+++ sofia-sip-1.12.11/libsofia-sip-ua/msg/msg_parser.c 2020-05-08 20:06:12.690000000 -0600
@@ -2468,8 +2468,6 @@ int msg_header_prepend(msg_t *msg,
msg_header_t **
msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
{
- int i;
-
assert(mc && hc);
if (mc == NULL || hc == NULL)
@@ -2484,9 +2482,20 @@ msg_hclass_offset(msg_mclass_t const *mc
}
else
/* Header has no name. */
- for (i = 0; i <= 6; i++)
- if (hc->hc_hash == mc->mc_request[i].hr_class->hc_hash)
- return (msg_header_t **)((char *)mo + mc->mc_request[i].hr_offset);
+ if (hc->hc_hash == mc->mc_request[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_request[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_status[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_status[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_separator[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_separator[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_payload[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_payload[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_unknown[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_unknown[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_error[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_error[0].hr_offset);
+ else if (hc->hc_hash == mc->mc_multipart[0].hr_class->hc_hash)
+ return (msg_header_t **)((char *)mo + mc->mc_multipart[0].hr_offset);
return NULL;
}
|