diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-11-12 04:08:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-11-12 04:08:47 +0000 |
commit | f9df7bfb1b61cb932b2fff494222e610dacca983 (patch) | |
tree | b3a258164f1cdd90e8ea4d197fdfa7e0c2a1c5c9 /libexec/spamd/grey.c | |
parent | e0e1079d841a081ed1f32126a366c9122ca6922e (diff) |
malloc() after line length check, to avoid memory leak; ok tedu
Diffstat (limited to 'libexec/spamd/grey.c')
-rw-r--r-- | libexec/spamd/grey.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/spamd/grey.c b/libexec/spamd/grey.c index d46af4bb4b5..d09c67871ce 100644 --- a/libexec/spamd/grey.c +++ b/libexec/spamd/grey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grey.c,v 1.47 2009/04/20 17:42:21 beck Exp $ */ +/* $OpenBSD: grey.c,v 1.48 2009/11/12 04:08:46 deraadt Exp $ */ /* * Copyright (c) 2004-2006 Bob Beck. All rights reserved. @@ -336,14 +336,14 @@ readsuffixlists(void) continue; if (buf[len-1] == '\n') len--; - if ((m = malloc(sizeof(struct mail_addr))) == NULL) - goto bad; if ((len + 1) > sizeof(m->addr)) { syslog_r(LOG_ERR, &sdata, "line too long in %s - file ignored", alloweddomains_file); goto bad; } + if ((m = malloc(sizeof(struct mail_addr))) == NULL) + goto bad; memcpy(m->addr, buf, len); m->addr[len]='\0'; syslog_r(LOG_ERR, &sdata, "got suffix %s", m->addr); |