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 518
 
515 519
 	len=strlen(str1);
516 520
 
517
-	s = (char*)pkg_malloc(len);
521
+	s = (char*)pkg_malloc(len+1);
518 522
 	if (!s) {
519 523
 		LOG(L_ERR, "AUTH_IDENTITY:append_hf: No memory left\n");
520 524
 		return -1;
521 525
 	}
522 526
 
523 527
 	memcpy(s, str1, len);
528
+	s[len] = '\0';
524 529
 
525 530
 	if (insert_new_lump_before(anchor, s, len, type) == 0) {
526 531
 		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 648
 				p += 4;
644 649
 				goto dc_end;
645 650
 			}
651
+			*type = HDR_OTHER_T;
652
+			break;
646 653
 		default:
647 654
 			/* compact headers */
648 655
 			switch(LOWER_BYTE(*p)) {
... ...
@@ -656,6 +663,8 @@ static char *auth_get_hf_name(char *begin, char *end, enum _hdr_types_t *type)
656 663
 					*type = HDR_CONTACT_T;
657 664
 					return (p + 2);
658 665
 				}
666
+				*type = HDR_OTHER_T;
667
+				break;
659 668
 			default:
660 669
 				*type = HDR_OTHER_T;
661 670
 				break;