Browse code

auth_identity: code clarity adjustments

Daniel-Constantin Mierla authored on 31/07/2017 12:53:08
Showing 1 changed files
... ...
@@ -471,7 +471,11 @@ int digeststr_asm(dynstr *sout, struct sip_msg *msg, str *sdate, int iflags)
471 471
 						LOG(L_ERR, "AUTH_IDENTITY:digeststr_asm: DATE header is not found\n");
472 472
 						return -9;
473 473
 					}
474
+					break;
474 475
 				}
476
+				if (app2dynstr(sout,&sact))
477
+					return -10;
478
+				break;
475 479
 			default:
476 480
 				if (iRes==AUTH_NOTFOUND)
477 481
 					break;
... ...
@@ -514,13 +518,14 @@ int append_hf(struct sip_msg* msg, char *str1, enum _hdr_types_t type)
514 514
 
515 515
 	len=strlen(str1);
516 516
 
517
-	s = (char*)pkg_malloc(len);
517
+	s = (char*)pkg_malloc(len+1);
518 518
 	if (!s) {
519 519
 		LOG(L_ERR, "AUTH_IDENTITY:append_hf: No memory left\n");
520 520
 		return -1;
521 521
 	}
522 522
 
523 523
 	memcpy(s, str1, len);
524
+	s[len] = '\0';
524 525
 
525 526
 	if (insert_new_lump_before(anchor, s, len, type) == 0) {
526 527
 		LOG(L_ERR, "AUTH_IDENTITY:append_hf: Can't insert lump\n");
... ...
@@ -643,6 +648,8 @@ static char *auth_get_hf_name(char *begin, char *end, enum _hdr_types_t *type)
643 643
 				p += 4;
644 644
 				goto dc_end;
645 645
 			}
646
+			*type = HDR_OTHER_T;
647
+			break;
646 648
 		default:
647 649
 			/* compact headers */
648 650
 			switch(LOWER_BYTE(*p)) {
... ...
@@ -656,6 +663,8 @@ static char *auth_get_hf_name(char *begin, char *end, enum _hdr_types_t *type)
656 656
 					*type = HDR_CONTACT_T;
657 657
 					return (p + 2);
658 658
 				}
659
+				*type = HDR_OTHER_T;
660
+				break;
659 661
 			default:
660 662
 				*type = HDR_OTHER_T;
661 663
 				break;