| Commit | Line | Data |
|---|---|---|
| e8b8add7 | 1 | $DragonFly: src/usr.sbin/sendmail/mci.c.patch,v 1.4 2007/04/14 17:43:48 gshapiro Exp $ |
| 6d160766 JS |
2 | |
| 3 | Index: mci.c | |
| 4 | =================================================================== | |
| b41c6d15 | 5 | RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/sendmail-8.13.6/sendmail/mci.c,v |
| 6d160766 JS |
6 | retrieving revision 1.1.1.1 |
| 7 | diff -u -r1.1.1.1 mci.c | |
| 8 | --- mci.c 6 Jun 2005 04:25:22 -0000 1.1.1.1 | |
| 9 | +++ mci.c 23 Aug 2005 15:04:54 -0000 | |
| b547daab | 10 | @@ -1131,7 +1131,7 @@ |
| 6d160766 JS |
11 | size_t len; |
| 12 | char *newptr; | |
| 13 | struct dirent *e; | |
| 14 | - char newpath[MAXPATHLEN]; | |
| 15 | + char newpath[PATH_MAX]; | |
| b41c6d15 GNS |
16 | #if MAXPATHLEN <= MAXNAMLEN - 3 |
| 17 | ERROR "MAXPATHLEN <= MAXNAMLEN - 3" | |
| 18 | #endif /* MAXPATHLEN <= MAXNAMLEN - 3 */ | |
| b547daab | 19 | @@ -1143,7 +1143,7 @@ |
| 6d160766 JS |
20 | pathname, sm_errstring(errno)); |
| 21 | return -1; | |
| 22 | } | |
| 23 | - len = sizeof(newpath) - MAXNAMLEN - 3; | |
| 24 | + len = sizeof(newpath) - 2; /* enough space for '/' and NUL */ | |
| 25 | if (sm_strlcpy(newpath, pathname, len) >= len) | |
| 26 | { | |
| 27 | if (tTd(56, 2)) | |
| b547daab | 28 | @@ -1153,6 +1153,7 @@ |
| 6d160766 JS |
29 | } |
| 30 | newptr = newpath + strlen(newpath); | |
| 31 | *newptr++ = '/'; | |
| 32 | + len = sizeof(newpath) - (newptr - newpath); | |
| 33 | ||
| 34 | /* | |
| 35 | ** repeat until no file has been removed | |
| b547daab | 36 | @@ -1169,9 +1170,8 @@ |
| 6d160766 JS |
37 | if (e->d_name[0] == '.') |
| 38 | continue; | |
| 39 | ||
| 40 | - (void) sm_strlcpy(newptr, e->d_name, | |
| e8b8add7 | 41 | - sizeof(newpath) - |
| 6d160766 JS |
42 | - (newptr - newpath)); |
| 43 | + if (sm_strlcpy(newptr, e->d_name, len) >= len) | |
| 44 | + continue; | |
| 45 | ||
| 46 | if (StopRequest) | |
| 47 | stop_sendmail(); |