[sr-dev] git:master:95034f62: xprint: check hdr type HDR_ERROR_T after parsing

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 2 18:49:25 CEST 2021


Module: kamailio
Branch: master
Commit: 95034f62d4a0cf536da1c5c26c748c1cf8ccb280
URL: https://github.com/kamailio/kamailio/commit/95034f62d4a0cf536da1c5c26c748c1cf8ccb280

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-02T18:48:50+02:00

xprint: check hdr type HDR_ERROR_T after parsing

---

Modified: src/modules/xprint/xp_lib.c

---

Diff:  https://github.com/kamailio/kamailio/commit/95034f62d4a0cf536da1c5c26c748c1cf8ccb280.diff
Patch: https://github.com/kamailio/kamailio/commit/95034f62d4a0cf536da1c5c26c748c1cf8ccb280.patch

---

diff --git a/src/modules/xprint/xp_lib.c b/src/modules/xprint/xp_lib.c
index b2bcc077b7..4adb5c31c6 100644
--- a/src/modules/xprint/xp_lib.c
+++ b/src/modules/xprint/xp_lib.c
@@ -1481,16 +1481,17 @@ static int _xl_parse_format(char *s, xl_elog_p *el, int shm, xl_parse_cb parse_c
 				/* ugly hack for compact header names -- !!fake length!!
 				 * -- parse_hname2 expects name buffer length >= 4
 				 */
-				if (parse_hname2(e->hparam.s,
+				parse_hname2(e->hparam.s,
 						e->hparam.s + ((e->hparam.len<4)?4:e->hparam.len),
-						&hdr)==0)
+						&hdr);
+				if(hdr.type==HDR_ERROR_T)
 				{
-					LOG(L_ERR,"xprint: xl_parse_format: strange error\n");
+					LOG(L_ERR,"xprint: xl_parse_format: header parsing error\n");
 					goto error;
 				}
 				e->hparam.len--;
 				e->hparam.s[e->hparam.len] = c;
-				if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T)
+				if (hdr.type!=HDR_OTHER_T)
 				{
 					LOG(L_INFO,"INFO:xprint: xl_parse_format: using "
 						"hdr type (%d) instead of <%.*s>\n",




More information about the sr-dev mailing list