From ff300598d7a6eb62ff5943e34793264a25bbaccf Mon Sep 17 00:00:00 2001 From: gshapiro Date: Fri, 19 Sep 2003 23:14:57 +0000 Subject: Fix sendmail 8.12.10 import conflicts --- contrib/sendmail/src/mci.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'contrib/sendmail/src/mci.c') diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index 033387b..a6b558e 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -9,11 +9,12 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #include -SM_RCSID("@(#)$Id: mci.c,v 8.205.2.3 2003/01/07 03:56:19 ca Exp $") +SM_RCSID("@(#)$Id: mci.c,v 8.205.2.4 2003/03/31 17:35:27 ca Exp $") #if NETINET || NETINET6 # include @@ -548,11 +549,21 @@ mci_dump(mci, logit) } (void) sm_snprintf(p, SPACELEFT(buf, p), "flags=%lx", mci->mci_flags); p += strlen(p); + + /* + ** The following check is just for paranoia. It protects the + ** assignment in the if() clause. If there's not some minimum + ** amount of space we can stop right now. The check will not + ** trigger as long as sizeof(buf)=4000. + */ + + if (p >= buf + sizeof(buf) - 4) + goto printit; if (mci->mci_flags != 0) { struct mcifbits *f; - *p++ = '<'; + *p++ = '<'; /* protected above */ for (f = MciFlags; f->mcif_bit != 0; f++) { if (!bitset(f->mcif_bit, mci->mci_flags)) @@ -1152,7 +1163,7 @@ mci_traverse_persistent(action, pathname) if (hostptr != host) *(hostptr++) = '.'; start = end; - while (*(start - 1) != '/') + while (start > pathname && *(start - 1) != '/') start--; if (*end == '.') @@ -1162,7 +1173,7 @@ mci_traverse_persistent(action, pathname) *(hostptr++) = *scan; end = start - 2; - } while (*end == '.'); + } while (end > pathname && *end == '.'); *hostptr = '\0'; @@ -1352,7 +1363,7 @@ mci_purge_persistent(pathname, hostname) /* ** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname ** -** Given `host', convert from a.b.c to $QueueDir/.hoststat/c./b./a, +** Given `host', convert from a.b.c to $HostStatDir/c./b./a, ** putting the result into `path'. if `createflag' is set, intervening ** directories will be created as needed. ** -- cgit v1.1