Browse code

bug_fix: a SF occured when a Record-routed value included no parameter (it popped up with CTD behind an Intertex box which record-routes without any params)

Jiri Kuthan authored on 30/06/2003 15:33:01
Showing 1 changed files
... ...
@@ -49,6 +49,11 @@
49 49
  */
50 50
 static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
51 51
 {
52
+
53
+	if (!_p->name.s) {
54
+		LOG(L_ERR, "ERROR: parse_contact_class: empty value\n");
55
+		return;
56
+	}
52 57
 	switch(_p->name.s[0]) {
53 58
 	case 'q':
54 59
 	case 'Q':
... ...
@@ -85,6 +90,11 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
85 90
  */
86 91
 static inline void parse_uri_class(param_hooks_t* _h, param_t* _p)
87 92
 {
93
+
94
+	if (!_p->name.s) {
95
+		LOG(L_ERR, "ERROR: parse_uri_class: empty value\n");
96
+		return;
97
+	}
88 98
 	switch(_p->name.s[0]) {
89 99
 	case 't':
90 100
 	case 'T':
... ...
@@ -237,6 +247,12 @@ static inline int parse_token_param(str* _s, str* _r)
237 247
  */
238 248
 static inline void parse_param_name(str* _s, pclass_t _c, param_hooks_t* _h, param_t* _p)
239 249
 {
250
+
251
+	if (!_s->s) {
252
+		DBG("DEBUG: parse_param_name: empty parameter\n");
253
+		return;
254
+	}
255
+
240 256
 	_p->name.s = _s->s;
241 257
 
242 258
 	while(_s->len) {
... ...
@@ -312,6 +328,11 @@ int parse_params(str* _s, pclass_t _c, param_hooks_t* _h, param_t** _p)
312 328
 	memset(_h, 0, sizeof(param_hooks_t));
313 329
 	*_p = 0;
314 330
 
331
+	if (!_s->s) { /* no parameters at all -- we're done */
332
+		DBG("DEBUG: parse_params: empty uri params, skipping\n");
333
+		return 0;
334
+	}
335
+			
315 336
 	while(1) {
316 337
 		t = (param_t*)pkg_malloc(sizeof(param_t));
317 338
 		if (t == 0) {