Browse code

core: print char code on error in parse_addr_spec()

(cherry picked from commit 031fd46980b34a570385f49f168b13af43d84b87)
(cherry picked from commit 86c5d807ceb896dcc554bf8f1b7fb93c68e69a73)

Daniel-Constantin Mierla authored on 04/09/2021 14:15:58
Showing 1 changed files
... ...
@@ -630,8 +630,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
630 630
 						status = saved_status;
631 631
 						goto endofheader;
632 632
 					default:
633
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
634
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
633
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
634
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
635 635
 						goto error;
636 636
 				}
637 637
 				break;
... ...
@@ -658,8 +658,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
658 658
 						status = saved_status;
659 659
 						goto endofheader;
660 660
 					default:
661
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
662
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
661
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
662
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
663 663
 						goto error;
664 664
 				}
665 665
 				break;
... ...
@@ -672,8 +672,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
672 672
 						saved_status = status = END;
673 673
 						goto endofheader;
674 674
 					default:
675
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
676
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
675
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
676
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
677 677
 						goto error;
678 678
 				}
679 679
 				break;
... ...
@@ -683,8 +683,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
683 683
 						tmp++; /* jump over next char */
684 684
 						break;
685 685
 					default:
686
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
687
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
686
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
687
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
688 688
 						goto error;
689 689
 				}
690 690
 				break;
... ...
@@ -715,8 +715,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
715 715
 						/*previous=crlf and now !=' '*/
716 716
 						goto endofheader;
717 717
 					default:
718
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
719
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
718
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
719
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
720 720
 						goto error;
721 721
 				}
722 722
 				break;
... ...
@@ -736,8 +736,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
736 736
 						/*previous=crlf and now !=' '*/
737 737
 						goto endofheader;
738 738
 					default:
739
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
740
-								*tmp, status, (int)(tmp - buffer), ZSW(buffer));
739
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
740
+								*tmp, *tmp, status, (int)(tmp - buffer), ZSW(buffer));
741 741
 						goto error;
742 742
 				}
743 743
 				break;
... ...
@@ -758,8 +758,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
758 758
 						/*previous=crlf and now !=' '*/
759 759
 						goto endofheader;
760 760
 					default:
761
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
762
-								*tmp, status, (int)(tmp - buffer), buffer);
761
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
762
+								*tmp, *tmp, status, (int)(tmp - buffer), buffer);
763 763
 						goto error;
764 764
 				}
765 765
 				break;
... ...
@@ -783,8 +783,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
783 783
 						/*previous=crlf and now !=' '*/
784 784
 						goto endofheader;
785 785
 					default:
786
-						LM_ERR("unexpected char [%c] in status %d: [%.*s] .\n",
787
-								*tmp, status, (int)(tmp - buffer), buffer);
786
+						LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] .\n",
787
+								*tmp, *tmp, status, (int)(tmp - buffer), buffer);
788 788
 						goto error;
789 789
 				}
790 790
 				break;
... ...
@@ -808,9 +808,9 @@ char *parse_addr_spec(char *const buffer, const char *const end,
808 808
 							/*previous=crlf and now !=' '*/
809 809
 							goto endofheader;
810 810
 						default:
811
-							LM_ERR("unexpected char [%c] in status %d: [%.*s] "
811
+							LM_ERR("unexpected char [%c/%d] in status %d: [%.*s] "
812 812
 									".\n",
813
-									*tmp, status, (int)(tmp - buffer), buffer);
813
+									*tmp, *tmp, status, (int)(tmp - buffer), buffer);
814 814
 							goto error;
815 815
 					}
816 816
 					break;
... ...
@@ -841,8 +841,8 @@ char *parse_addr_spec(char *const buffer, const char *const end,
841 841
 						/*previous=crlf and now !=' '*/
842 842
 						goto endofheader;
843 843
 					default:
844
-						LM_DBG("spitting out [%c] in status %d\n", *tmp,
845
-								status);
844
+						LM_DBG("spitting out [%c/%d] in status %d\n", *tmp,
845
+								*tmp, status);
846 846
 						goto error;
847 847
 				}
848 848
 		} /*char switch*/
... ...
@@ -872,7 +872,7 @@ endofheader:
872 872
 		case E_PARA_VALUE:
873 873
 			break;
874 874
 		default:
875
-			LM_ERR("invalid To -  unexpected "
875
+			LM_ERR("invalid body -  unexpected "
876 876
 					"end of header in state %d\n",
877 877
 					status);
878 878
 			goto error;