diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-05-14 21:48:00 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-05-14 21:48:00 +0000 |
commit | 23955f5dd00aff51e84978f78ce3b800fd5143b2 (patch) | |
tree | e642c8b53f98b91f43a4baa39fd164185fbb4ef4 /driver.c | |
parent | 53d079783a95455d62ac3ed5bab8d7ef4b68567f (diff) | |
download | fetchmail-23955f5dd00aff51e84978f78ce3b800fd5143b2.tar.gz fetchmail-23955f5dd00aff51e84978f78ce3b800fd5143b2.tar.bz2 fetchmail-23955f5dd00aff51e84978f78ce3b800fd5143b2.zip |
Detect embedded NULs.
svn path=/trunk/; revision=1006
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -446,7 +446,7 @@ char *realname; /* real name of host */ #endif /* HAVE_GETHOSTBYNAME */ char *cp; struct idlist *idp, *xmit_names; - int good_addresses, bad_addresses; + int good_addresses, bad_addresses, has_nuls; #ifdef HAVE_RES_SEARCH int no_local_matches = FALSE; #endif /* HAVE_RES_SEARCH */ @@ -454,6 +454,7 @@ char *realname; /* real name of host */ sizeticker = 0; delete_ok = TRUE; + has_nuls = FALSE; remaining = len; olderrs = ctl->errcount; @@ -506,6 +507,9 @@ char *realname; /* real name of host */ } } + if (linelen != strlen(line)) + has_nuls = TRUE; + remaining -= linelen; /* check for end of headers; don't save terminating line */ @@ -918,9 +922,9 @@ char *realname; /* real name of host */ /* write error notifications */ #ifdef HAVE_RES_SEARCH - if (no_local_matches || bad_addresses) + if (no_local_matches || has_nuls || bad_addresses) #else - if (bad_addresses) + if (has_nuls || bad_addresses) #endif /* HAVE_RES_SEARCH */ { int errlen = 0; @@ -940,14 +944,20 @@ char *realname; /* real name of host */ break; sprintf(errhd+strlen(errhd), "recipient address %s didn't match any local name", idp->id); } + } +#endif /* HAVE_RES_SEARCH */ - if (bad_addresses) + if (has_nuls) + { + if (errhd[sizeof("X-Fetchmail-Warning: ")]) strcat(errhd, "; "); + strcat(errhd, "message has embedded NULs"); } -#endif /* HAVE_RES_SEARCH */ if (bad_addresses) { + if (errhd[sizeof("X-Fetchmail-Warning: ")]) + strcat(errhd, "; "); strcat(errhd, "SMTP listener rejected local recipient addresses: "); errlen = strlen(errhd); for (idp = xmit_names; idp; idp = idp->next) @@ -963,6 +973,7 @@ char *realname; /* real name of host */ if (idp->next) strcat(errmsg, ", "); } + } if (ctl->mda && !ctl->forcecr) |