summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-05-02 10:01:34 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-05-02 10:15:26 +0200
commite10fe19f4578b8215587825e8672a196dc161b93 (patch)
treea14a03b25a6b063874b22e85e8d532cd6a221619
parent23be4d12401b000874c3aa0a5104e54ba39a3d02 (diff)
downloadtcpdump-e10fe19f4578b8215587825e8672a196dc161b93.tar.gz
Remove the safeputs() function
Use the nd_printzp() function instead.
-rw-r--r--netdissect.h2
-rw-r--r--print-cfm.c6
-rw-r--r--print-eap.c4
-rw-r--r--print-hncp.c12
-rw-r--r--print-lldp.c24
-rw-r--r--print-ospf.c2
-rw-r--r--print-vqp.c2
-rw-r--r--util-print.c13
8 files changed, 25 insertions, 40 deletions
diff --git a/netdissect.h b/netdissect.h
index 937c57e1..81c767e1 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -355,8 +355,6 @@ extern void txtproto_print(netdissect_options *, const u_char *, u_int,
#define ND_ISGRAPH(c) ((c) > 0x20 && (c) <= 0x7E)
#define ND_TOASCII(c) ((c) & 0x7F)
-extern void safeputs(netdissect_options *, const u_char *, const u_int);
-
#if (defined(__i386__) || defined(_M_IX86) || defined(__X86__) || defined(__x86_64__) || defined(_M_X64)) || \
(defined(__arm__) || defined(_M_ARM) || defined(__aarch64__)) || \
(defined(__m68k__) && (!defined(__mc68000__) && !defined(__mc68010__))) || \
diff --git a/print-cfm.c b/print-cfm.c
index 568e3036..8b3e3e00 100644
--- a/print-cfm.c
+++ b/print-cfm.c
@@ -404,7 +404,7 @@ cfm_print(netdissect_options *ndo,
switch (md_nameformat) {
case CFM_CCM_MD_FORMAT_DNS:
case CFM_CCM_MD_FORMAT_CHAR:
- safeputs(ndo, md_name, md_namelength);
+ (void)nd_printzp(ndo, md_name, md_namelength, NULL);
break;
case CFM_CCM_MD_FORMAT_MAC:
@@ -456,7 +456,7 @@ cfm_print(netdissect_options *ndo,
ND_PRINT("\n\t MA Name: ");
switch (ma_nameformat) {
case CFM_CCM_MA_FORMAT_CHAR:
- safeputs(ndo, ma_name, ma_namelength);
+ (void)nd_printzp(ndo, ma_name, ma_namelength, NULL);
break;
/* FIXME add printers for those MA formats - hexdump for now */
@@ -662,7 +662,7 @@ cfm_print(netdissect_options *ndo,
case CFM_CHASSIS_ID_LOCAL:
case CFM_CHASSIS_ID_CHASSIS_COMPONENT:
case CFM_CHASSIS_ID_PORT_COMPONENT:
- safeputs(ndo, tptr + 1, chassis_id_length);
+ (void)nd_printzp(ndo, tptr + 1, chassis_id_length, NULL);
break;
default:
diff --git a/print-eap.c b/print-eap.c
index a9416822..6225e9f2 100644
--- a/print-eap.c
+++ b/print-eap.c
@@ -207,14 +207,14 @@ eap_print(netdissect_options *ndo,
case EAP_TYPE_IDENTITY:
if (len - 5 > 0) {
ND_PRINT(", Identity: ");
- safeputs(ndo, tptr + 5, len - 5);
+ (void)nd_printzp(ndo, tptr + 5, len - 5, NULL);
}
break;
case EAP_TYPE_NOTIFICATION:
if (len - 5 > 0) {
ND_PRINT(", Notification: ");
- safeputs(ndo, tptr + 5, len - 5);
+ (void)nd_printzp(ndo, tptr + 5, len - 5, NULL);
}
break;
diff --git a/print-hncp.c b/print-hncp.c
index ab190dd5..13064678 100644
--- a/print-hncp.c
+++ b/print-hncp.c
@@ -251,11 +251,11 @@ print_dns_label(netdissect_options *ndo,
ND_PRINT(".");
if (length+lab_length > max_length) {
if (print)
- safeputs(ndo, cp+length, max_length-length);
+ (void)nd_printzp(ndo, cp+length, max_length-length, NULL);
break;
}
if (print)
- safeputs(ndo, cp+length, lab_length);
+ (void)nd_printzp(ndo, cp+length, lab_length, NULL);
length += lab_length;
}
if (print)
@@ -585,7 +585,7 @@ hncp_print_rec(netdissect_options *ndo,
ND_PRINT(" Verdict: %u Fingerprint: %s Common Name: ",
EXTRACT_U_1(value),
format_256(value + 4));
- safeputs(ndo, value + 36, bodylen - 36);
+ (void)nd_printzp(ndo, value + 36, bodylen - 36, NULL);
}
break;
@@ -604,7 +604,7 @@ hncp_print_rec(netdissect_options *ndo,
ND_PRINT(" M: %u P: %u H: %u L: %u User-agent: ",
M, P, H, L
);
- safeputs(ndo, value + 4, bodylen - 4);
+ (void)nd_printzp(ndo, value + 4, bodylen - 4, NULL);
}
break;
@@ -689,7 +689,7 @@ hncp_print_rec(netdissect_options *ndo,
print_dns_label(ndo, value+1, bodylen-1, 1);
} else if (policy == 130) {
ND_PRINT("Opaque UTF-8: ");
- safeputs(ndo, value + 1, bodylen - 1);
+ (void)nd_printzp(ndo, value + 1, bodylen - 1, NULL);
} else if (policy == 131) {
if (bodylen != 1) {
ND_PRINT(" %s", istr);
@@ -819,7 +819,7 @@ hncp_print_rec(netdissect_options *ndo,
);
if (l < 64) {
ND_PRINT("\"");
- safeputs(ndo, value + 17, l);
+ (void)nd_printzp(ndo, value + 17, l, NULL);
ND_PRINT("\"");
} else {
ND_PRINT("%s", istr);
diff --git a/print-lldp.c b/print-lldp.c
index 1adbae0d..a200228e 100644
--- a/print-lldp.c
+++ b/print-lldp.c
@@ -699,7 +699,7 @@ lldp_private_8021_print(netdissect_options *ndo,
return hexdump;
}
ND_PRINT("\n\t vlan name: ");
- safeputs(ndo, tptr + 7, sublen);
+ (void)nd_printzp(ndo, tptr + 7, sublen, NULL);
break;
case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_IDENTITY:
if (tlv_len < 5) {
@@ -710,7 +710,7 @@ lldp_private_8021_print(netdissect_options *ndo,
return hexdump;
}
ND_PRINT("\n\t protocol identity: ");
- safeputs(ndo, tptr + 5, sublen);
+ (void)nd_printzp(ndo, tptr + 5, sublen, NULL);
break;
case LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION:
if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){
@@ -1068,7 +1068,7 @@ lldp_private_tia_print(netdissect_options *ndo,
EXTRACT_U_1(tptr + 6));
/* Country code */
- safeputs(ndo, tptr + 7, 2);
+ (void)nd_printzp(ndo, tptr + 7, 2, NULL);
lci_len = lci_len-3;
tptr = tptr + 9;
@@ -1096,7 +1096,7 @@ lldp_private_tia_print(netdissect_options *ndo,
return hexdump;
}
- safeputs(ndo, tptr, ca_len);
+ (void)nd_printzp(ndo, tptr, ca_len, NULL);
tptr += ca_len;
lci_len -= ca_len;
}
@@ -1104,7 +1104,7 @@ lldp_private_tia_print(netdissect_options *ndo,
case LLDP_TIA_LOCATION_DATA_FORMAT_ECS_ELIN:
ND_PRINT("\n\t ECS ELIN id ");
- safeputs(ndo, tptr + 5, tlv_len - 5);
+ (void)nd_printzp(ndo, tptr + 5, tlv_len - 5, NULL);
break;
default:
@@ -1141,7 +1141,7 @@ lldp_private_tia_print(netdissect_options *ndo,
case LLDP_PRIVATE_TIA_SUBTYPE_INVENTORY_ASSET_ID:
ND_PRINT("\n\t %s ",
tok2str(lldp_tia_inventory_values, "unknown", subtype));
- safeputs(ndo, tptr + 4, tlv_len - 4);
+ (void)nd_printzp(ndo, tptr + 4, tlv_len - 4, NULL);
break;
default:
@@ -1421,7 +1421,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo,
}
if (oid_len) {
ND_PRINT("\n\t OID length %u", oid_len);
- safeputs(ndo, tptr + 1, oid_len);
+ (void)nd_printzp(ndo, tptr + 1, oid_len, NULL);
}
}
@@ -1498,7 +1498,7 @@ lldp_print(netdissect_options *ndo,
case LLDP_CHASSIS_CHASSIS_COMP_SUBTYPE:
case LLDP_CHASSIS_INTF_ALIAS_SUBTYPE:
case LLDP_CHASSIS_PORT_COMP_SUBTYPE:
- safeputs(ndo, tptr + 1, tlv_len - 1);
+ (void)nd_printzp(ndo, tptr + 1, tlv_len - 1, NULL);
break;
case LLDP_CHASSIS_NETWORK_ADDR_SUBTYPE:
@@ -1539,7 +1539,7 @@ lldp_print(netdissect_options *ndo,
case LLDP_PORT_AGENT_CIRC_ID_SUBTYPE:
case LLDP_PORT_INTF_ALIAS_SUBTYPE:
case LLDP_PORT_PORT_COMP_SUBTYPE:
- safeputs(ndo, tptr + 1, tlv_len - 1);
+ (void)nd_printzp(ndo, tptr + 1, tlv_len - 1, NULL);
break;
case LLDP_PORT_NETWORK_ADDR_SUBTYPE:
@@ -1569,7 +1569,7 @@ lldp_print(netdissect_options *ndo,
case LLDP_PORT_DESCR_TLV:
if (ndo->ndo_vflag) {
ND_PRINT(": ");
- safeputs(ndo, tptr, tlv_len);
+ (void)nd_printzp(ndo, tptr, tlv_len, NULL);
}
break;
@@ -1579,13 +1579,13 @@ lldp_print(netdissect_options *ndo,
* similar to the CDP printer.
*/
ND_PRINT(": ");
- safeputs(ndo, tptr, tlv_len);
+ (void)nd_printzp(ndo, tptr, tlv_len, NULL);
break;
case LLDP_SYSTEM_DESCR_TLV:
if (ndo->ndo_vflag) {
ND_PRINT("\n\t ");
- safeputs(ndo, tptr, tlv_len);
+ (void)nd_printzp(ndo, tptr, tlv_len, NULL);
}
break;
diff --git a/print-ospf.c b/print-ospf.c
index 8907df14..4c5ba665 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -1168,7 +1168,7 @@ ospf_print(netdissect_options *ndo,
case OSPF_AUTH_SIMPLE:
ND_PRINT("\n\tSimple text password: ");
- safeputs(ndo, op->ospf_authdata, OSPF_AUTH_SIMPLE_LEN);
+ (void)nd_printzp(ndo, op->ospf_authdata, OSPF_AUTH_SIMPLE_LEN, NULL);
break;
case OSPF_AUTH_MD5:
diff --git a/print-vqp.c b/print-vqp.c
index ab00a799..3e8e011c 100644
--- a/print-vqp.c
+++ b/print-vqp.c
@@ -188,7 +188,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
case VQP_OBJ_VLAN_NAME:
case VQP_OBJ_VTP_DOMAIN:
case VQP_OBJ_ETHERNET_PKT:
- safeputs(ndo, tptr, vqp_obj_len);
+ (void)nd_printzp(ndo, tptr, vqp_obj_len, NULL);
break;
/* those objects have similar semantics - fall through */
case VQP_OBJ_MAC_ADDRESS:
diff --git a/util-print.c b/util-print.c
index dc2f532a..1a54a42a 100644
--- a/util-print.c
+++ b/util-print.c
@@ -902,19 +902,6 @@ txtproto_print(netdissect_options *ndo, const u_char *pptr, u_int len,
}
}
-void
-safeputs(netdissect_options *ndo,
- const u_char *s, const u_int maxlen)
-{
- u_int idx = 0;
-
- while (idx < maxlen && EXTRACT_U_1(s)) {
- fn_print_char(ndo, EXTRACT_U_1(s));
- idx++;
- s++;
- }
-}
-
#if (defined(__i386__) || defined(_M_IX86) || defined(__X86__) || defined(__x86_64__) || defined(_M_X64)) || \
(defined(__arm__) || defined(_M_ARM) || defined(__aarch64__)) || \
(defined(__m68k__) && (!defined(__mc68000__) && !defined(__mc68010__))) || \