diff options
author | 2003-04-25 19:07:28 +0000 | |
---|---|---|
committer | 2003-04-25 19:07:28 +0000 | |
commit | 40130db0d4c9a7f9c87c4d736e1c3db96fd299a6 (patch) | |
tree | 093fb6574b631798e19f17095d1e2dd626f8b727 | |
parent | Document changes to mquery(2) function signature change, now the same as mmap(2) (diff) | |
download | wireguard-openbsd-40130db0d4c9a7f9c87c4d736e1c3db96fd299a6.tar.xz wireguard-openbsd-40130db0d4c9a7f9c87c4d736e1c3db96fd299a6.zip |
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); } |