From bad4ad66b980ce6b89cf7b3578cdfd3098b929b6 Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Wed, 21 Apr 2010 21:40:57 +0000 Subject: when creating a map, make sure we do not store a key/val separator at the beginning of the key (ie: "gilles: bleh" should not be stored as key[gilles] val[ bleh]) --- usr.sbin/smtpd/makemap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index a707c6220c2..e3217833a4a 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.24 2009/11/08 23:08:56 gilles Exp $ */ +/* $OpenBSD: makemap.c,v 1.25 2010/04/21 21:40:56 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -255,6 +255,10 @@ parse_mapentry(char *line, size_t len, size_t lineno) strsep(&valp, " \t:"); if (valp == NULL || valp == keyp) goto bad; + while (*valp == ':' || isspace((int)*valp)) + valp++; + if (*valp == '\0' || *valp == '#') + goto bad; /* Check for dups. */ key.data = keyp; -- cgit v1.2.3