$DragonFly: src/usr.sbin/sendmail/mci.c.patch,v 1.3 2006/06/14 17:56:12 gshapiro Exp $ Index: mci.c =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/sendmail-8.13.6/sendmail/mci.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 mci.c --- mci.c 6 Jun 2005 04:25:22 -0000 1.1.1.1 +++ mci.c 23 Aug 2005 15:04:54 -0000 @@ -1131,7 +1131,7 @@ size_t len; char *newptr; struct dirent *e; - char newpath[MAXPATHLEN]; + char newpath[PATH_MAX]; #if MAXPATHLEN <= MAXNAMLEN - 3 ERROR "MAXPATHLEN <= MAXNAMLEN - 3" #endif /* MAXPATHLEN <= MAXNAMLEN - 3 */ @@ -1143,7 +1143,7 @@ pathname, sm_errstring(errno)); return -1; } - len = sizeof(newpath) - MAXNAMLEN - 3; + len = sizeof(newpath) - 2; /* enough space for '/' and NUL */ if (sm_strlcpy(newpath, pathname, len) >= len) { if (tTd(56, 2)) @@ -1153,6 +1153,7 @@ } newptr = newpath + strlen(newpath); *newptr++ = '/'; + len = sizeof(newpath) - (newptr - newpath); /* ** repeat until no file has been removed @@ -1169,9 +1170,8 @@ if (e->d_name[0] == '.') continue; - (void) sm_strlcpy(newptr, e->d_name, - sizeof newpath - - (newptr - newpath)); + if (sm_strlcpy(newptr, e->d_name, len) >= len) + continue; if (StopRequest) stop_sendmail();