From 38c2bcf5da548b953063fd651ec3d0ebb52c73f8 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 4 May 2011 12:10:59 +0200 Subject: Make macro expansions safer for VALID_ADDRESS and RBUF_WRITE. --- transact.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'transact.c') diff --git a/transact.c b/transact.c index 8f25b9d1..b20cfd05 100644 --- a/transact.c +++ b/transact.c @@ -201,7 +201,7 @@ static void find_server_names(const char *hdr, * are not uncommon. So now we just check that the following token is * not itself an email address. */ -#define VALID_ADDRESS(a) !strchr(a, '@') +#define VALID_ADDRESS(a) (!strchr((a), '@')) static char *parse_received(struct query *ctl, char *bufp) /* try to extract real address from the Received line */ @@ -217,7 +217,7 @@ static char *parse_received(struct query *ctl, char *bufp) static char rbuf[HOSTLEN + USERNAMELEN + 4]; struct addrinfo *ai0; -#define RBUF_WRITE(value) if (tp < rbuf+sizeof(rbuf)-1) *tp++=value +#define RBUF_WRITE(value) do { if (tp < rbuf+sizeof(rbuf)-1) *tp++=(value); } while(0) /* * Try to extract the real envelope addressee. We look here -- cgit v1.2.3