[sr-dev] git:master:3913cc88: parse: more log messages in case of errors in parse_hname2_short()

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 15 13:12:22 CEST 2015


Module: kamailio
Branch: master
Commit: 3913cc881030cccc9518733e18363402f2dfb18e
URL: https://github.com/kamailio/kamailio/commit/3913cc881030cccc9518733e18363402f2dfb18e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-15T13:08:53+02:00

parse: more log messages in case of errors in parse_hname2_short()

---

Modified: parser/parse_hname2.c

---

Diff:  https://github.com/kamailio/kamailio/commit/3913cc881030cccc9518733e18363402f2dfb18e.diff
Patch: https://github.com/kamailio/kamailio/commit/3913cc881030cccc9518733e18363402f2dfb18e.patch

---

diff --git a/parser/parse_hname2.c b/parser/parse_hname2.c
index ff273d0..9db38af 100644
--- a/parser/parse_hname2.c
+++ b/parser/parse_hname2.c
@@ -276,12 +276,18 @@ char* parse_hname2_short(char* const begin, const char* const end, struct hdr_fi
 			return parse_hname2(begin, end, hdr);
 		}
 		/* not enough space */
+		LM_ERR("not enough space to parse the header name in [%.*s] (%d)\n",
+				(int)(end-begin), begin, (int)(end-begin));
 		return NULL;
 	}
 	/* pad with whitespace - tipycal char after the ':' of the header name */
 	memset(hbuf, ' ', HBUF_MAX_SIZE);
 	memcpy(hbuf, begin, end-begin);
 	p = parse_hname2(hbuf, hbuf + 4 + (end-begin), hdr);
-	if(!p) return NULL;
+	if(!p) {
+		LM_ERR("failed to parse the header name in [%.*s] (%d)\n",
+				(int)(end-begin), begin, (int)(end-begin));
+		return NULL;
+	}
 	return begin + (p-hbuf);
 }




More information about the sr-dev mailing list