diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2005-03-02 16:45:31 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2005-03-02 16:45:31 +0000 |
commit | dae7e8974e3a4f2f4cb9382e5c27b4eb24d19ff1 (patch) | |
tree | 52bf289842ce480db8aad9c761bccc12c453ed92 /libexec/spamd-setup | |
parent | 75699d05e12889fd103ff022333d521b76b4eebd (diff) |
process the last line of an address list even if it's not terminated
by newline. found by Rod Whitworth. ok beck@
Diffstat (limited to 'libexec/spamd-setup')
-rw-r--r-- | libexec/spamd-setup/spamd-setup.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c index 739d4d9a53a..9b196698976 100644 --- a/libexec/spamd-setup/spamd-setup.c +++ b/libexec/spamd-setup/spamd-setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd-setup.c,v 1.20 2004/09/16 05:35:24 deraadt Exp $ */ +/* $OpenBSD: spamd-setup.c,v 1.21 2005/03/02 16:45:30 dhartmei Exp $ */ /* * Copyright (c) 2003 Bob Beck. All rights reserved. @@ -473,7 +473,7 @@ add_blacklist(struct bl *bl, int *blc, int *bls, gzFile gzf, int white) if (bu == bs) { char *tmp; - tmp = realloc(buf, bs + 8192); + tmp = realloc(buf, bs + 8192 + 1); if (tmp == NULL) { free(buf); buf = NULL; @@ -496,7 +496,7 @@ add_blacklist(struct bl *bl, int *blc, int *bls, gzFile gzf, int white) } parse: start = 0; - for (i = 0; i < bu; i++) { + for (i = 0; i <= bu; i++) { if (*blc == *bls) { struct bl *tmp; @@ -509,7 +509,7 @@ add_blacklist(struct bl *bl, int *blc, int *bls, gzFile gzf, int white) } bl = tmp; } - if (buf[i] == '\n') { + if (i == bu || buf[i] == '\n') { buf[i] = '\0'; if (parse_netblock(buf + start, bl + *blc, bl + *blc + 1, white)) |