diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-04-25 19:07:29 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2003-04-25 19:07:29 +0000 |
commit | 600cbc5b3f73fb4194f08869aed1aaa747b5b8e0 (patch) | |
tree | ec801e9a778b4fed90b35d2484de41a5ede9435a | |
parent | 9dbe2104dd632a75ae5b8b96c75bec679b9c7132 (diff) |
check asprintf return value for error as well, some implementations do
not set the pointer to NULL necessarily; ok dhartmei, henning, kjell
-rw-r--r-- | sbin/pfctl/pfctl_table.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 78b17ce3ccf..a93582ff9f5 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_table.c,v 1.38 2003/04/05 23:56:32 henning Exp $ */ +/* $OpenBSD: pfctl_table.c,v 1.39 2003/04/25 19:07:28 pvalchev Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -571,18 +571,19 @@ void pfctl_append_addr(char *addr, int net, int neg) { char *p = NULL; + int rval; if (net < 0 && !neg) { append_addr(addr, 0); return; } if (net >= 0 && !neg) - asprintf(&p, "%s/%d", addr, net); + rval = asprintf(&p, "%s/%d", addr, net); else if (net < 0) - asprintf(&p, "!%s", addr); + rval = asprintf(&p, "!%s", addr); else - asprintf(&p, "!%s/%d", addr, net); - if (p == NULL) { + rval = asprintf(&p, "!%s/%d", addr, net); + if (rval == -1 || p == NULL) { radix_perror(); exit(1); } |