@@ -871,19 +871,13 @@ handle_chap(netdissect_options *ndo,
871871 }
872872 name_size = len - (u_int )(p - p0 );
873873 ND_PRINT (", Name " );
874- for (i = 0 ; i < name_size ; i ++ ) {
875- fn_print_char (ndo , GET_U_1 (p ));
876- p ++ ;
877- }
874+ nd_printjn (ndo , p , name_size );
878875 break ;
879876 case CHAP_SUCC :
880877 case CHAP_FAIL :
881878 msg_size = len - (u_int )(p - p0 );
882879 ND_PRINT (", Msg " );
883- for (i = 0 ; i < msg_size ; i ++ ) {
884- fn_print_char (ndo , GET_U_1 (p ));
885- p ++ ;
886- }
880+ nd_printjn (ndo , p , msg_size );
887881 break ;
888882 }
889883}
@@ -896,7 +890,6 @@ handle_pap(netdissect_options *ndo,
896890 u_int code , len ;
897891 u_int peerid_len , passwd_len , msg_len ;
898892 const u_char * p0 ;
899- u_int i ;
900893
901894 p0 = p ;
902895 if (length < 1 ) {
@@ -941,10 +934,8 @@ handle_pap(netdissect_options *ndo,
941934 if (length - (p - p0 ) < peerid_len )
942935 return ;
943936 ND_PRINT (", Peer " );
944- for (i = 0 ; i < peerid_len ; i ++ ) {
945- fn_print_char (ndo , GET_U_1 (p ));
946- p ++ ;
947- }
937+ nd_printjn (ndo , p , peerid_len );
938+ p += peerid_len ;
948939
949940 if (length - (p - p0 ) < 1 )
950941 return ;
@@ -953,10 +944,7 @@ handle_pap(netdissect_options *ndo,
953944 if (length - (p - p0 ) < passwd_len )
954945 return ;
955946 ND_PRINT (", Name " );
956- for (i = 0 ; i < passwd_len ; i ++ ) {
957- fn_print_char (ndo , GET_U_1 (p ));
958- p ++ ;
959- }
947+ nd_printjn (ndo , p , passwd_len );
960948 break ;
961949 case PAP_AACK :
962950 case PAP_ANAK :
@@ -974,10 +962,7 @@ handle_pap(netdissect_options *ndo,
974962 if (length - (p - p0 ) < msg_len )
975963 return ;
976964 ND_PRINT (", Msg " );
977- for (i = 0 ; i < msg_len ; i ++ ) {
978- fn_print_char (ndo , GET_U_1 (p ));
979- p ++ ;
980- }
965+ nd_printjn (ndo , p , msg_len );
981966 break ;
982967 }
983968 return ;
0 commit comments