diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-06-07 17:43:07 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-06-07 17:43:07 +0000 |
commit | 7550d218a324b28c644b43afcee6b917d70d8930 (patch) | |
tree | 5a2c161ae1462c9412448c46423ffb0e97b23552 /usr.sbin/bgpctl | |
parent | ff809ea61a82bbebff839e33353ecc54ad87e97f (diff) |
In case strlcpy() indicates that a string was truncated fail with errx().
No need for other strange constructs. OK henning@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index fce51dd1c53..7f78ebe7618 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.15 2005/06/06 17:13:56 henning Exp $ */ +/* $OpenBSD: parser.c,v 1.16 2005/06/07 17:43:06 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -368,7 +368,8 @@ match_token(const char *word, const struct token table[]) if (strlcpy(res.peerdesc, word, sizeof(res.peerdesc)) >= sizeof(res.peerdesc)) - err(1, "neighbor description too long"); + errx(1, "neighbor description too " + "long"); match++; t = &table[i]; } @@ -405,12 +406,8 @@ match_token(const char *word, const struct token table[]) err(1, NULL); if (strlcpy(fs->action.pftable, word, sizeof(fs->action.pftable)) >= - sizeof(fs->action.pftable)) { - fprintf(stderr, - "pftable name too long"); - free(fs); - break; - } + sizeof(fs->action.pftable)) + errx(1, "pftable name too long"); SIMPLEQ_INSERT_TAIL(&res.set, fs, entry); match++; t = &table[i]; |