diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2002-12-08 17:00:20 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2002-12-08 17:00:20 +0000 |
commit | 63e624d32431e9175a9dfe08dbaa034ea7998366 (patch) | |
tree | 3055f764db14e25cd986def444d62258e3051524 /sbin/pfctl/parse.y | |
parent | c5a38b6fdf1c2335f7f5558976e478f12d297990 (diff) |
strncpy is evil.
Diffstat (limited to 'sbin/pfctl/parse.y')
-rw-r--r-- | sbin/pfctl/parse.y | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index a39c6e0eebb..5c1eb2f33b3 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.245 2002/12/08 00:19:47 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.246 2002/12/08 17:00:19 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -1290,7 +1290,7 @@ address : '(' STRING ')' { $$->af = 0; set_ipmask($$, 128); $$->addr.addr_dyn = (struct pf_addr_dyn *)1; - strncpy($$->addr.addr.pfa.ifname, $2, + strlcpy($$->addr.addr.pfa.ifname, $2, sizeof($$->addr.addr.pfa.ifname)); $$->next = NULL; $$->tail = $$; @@ -2540,7 +2540,7 @@ expand_label_if(const char *name, char *label, const char *ifname) else strlcat(tmp, ifname, PF_RULE_LABEL_SIZE); strlcat(tmp, p+strlen(name), PF_RULE_LABEL_SIZE); - strncpy(label, tmp, PF_RULE_LABEL_SIZE); + strlcpy(label, tmp, PF_RULE_LABEL_SIZE); } } @@ -2582,7 +2582,7 @@ expand_label_addr(const char *name, char *label, sa_family_t af, strlcat(tmp, a, PF_RULE_LABEL_SIZE); } strlcat(tmp, p+strlen(name), PF_RULE_LABEL_SIZE); - strncpy(label, tmp, PF_RULE_LABEL_SIZE); + strlcpy(label, tmp, PF_RULE_LABEL_SIZE); } } @@ -2620,7 +2620,7 @@ expand_label_port(const char *name, char *label, struct node_port *port) snprintf(op, sizeof(op), ">=%s", a1); strlcat(tmp, op, PF_RULE_LABEL_SIZE); strlcat(tmp, p+strlen(name), PF_RULE_LABEL_SIZE); - strncpy(label, tmp, PF_RULE_LABEL_SIZE); + strlcpy(label, tmp, PF_RULE_LABEL_SIZE); } } @@ -2641,7 +2641,7 @@ expand_label_proto(const char *name, char *label, u_int8_t proto) snprintf(tmp+strlen(tmp), PF_RULE_LABEL_SIZE-strlen(tmp), "%u", proto); strlcat(tmp, p+strlen(name), PF_RULE_LABEL_SIZE); - strncpy(label, tmp, PF_RULE_LABEL_SIZE); + strlcpy(label, tmp, PF_RULE_LABEL_SIZE); } } @@ -2657,7 +2657,7 @@ expand_label_nr(const char *name, char *label) snprintf(tmp+strlen(tmp), PF_RULE_LABEL_SIZE-strlen(tmp), "%u", pf->rule_nr); strlcat(tmp, p+strlen(name), PF_RULE_LABEL_SIZE); - strncpy(label, tmp, PF_RULE_LABEL_SIZE); + strlcpy(label, tmp, PF_RULE_LABEL_SIZE); } } @@ -2919,7 +2919,7 @@ expand_rule(struct pf_rule *r, } pa->addr = h->addr; if (h->ifname != NULL) - strncpy(pa->ifname, h->ifname, IFNAMSIZ); + strlcpy(pa->ifname, h->ifname, IFNAMSIZ); else pa->ifname[0] = 0; TAILQ_INSERT_TAIL(&r->rt_pool.list, pa, entries); |