diff --git a/CHANGELOG b/CHANGELOG index e559db26a..007b208d9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o The --excludefile option correctly handles files with no terminating + newline instead of claiming "Exclude file line 0 was too long to + read." [Henri Doreau] + o Nsock handles a certain Windows connect error, WSAEADDRNOTAVAIL (errno 10049), preventing an assertion failure that looked like Strange connect error from 203.65.42.255 (10049): No such file or directory diff --git a/targets.cc b/targets.cc index caae07749..2bac50a4b 100644 --- a/targets.cc +++ b/targets.cc @@ -283,7 +283,8 @@ TargetGroup* load_exclude(FILE *fExclude, char *szExclude) { * in the file, and reset the file */ if (1 == b_file) { while ((char *)0 != fgets(acBuf,sizeof(acBuf), fExclude)) { - if ((char *)0 == strchr(acBuf, '\n')) { + /* the last line can contain no newline, then we have to check for EOF */ + if ((char *)0 == strchr(acBuf, '\n') && !feof(fExclude)) { fatal("Exclude file line %d was too long to read. Exiting.", iLine); } pc=strtok(acBuf, "\t\n "); @@ -317,7 +318,7 @@ TargetGroup* load_exclude(FILE *fExclude, char *szExclude) { /* If we are parsing a file load the exclude list from that */ while ((char *)0 != fgets(acBuf, sizeof(acBuf), fExclude)) { ++iLine; - if ((char *)0 == strchr(acBuf, '\n')) { + if ((char *)0 == strchr(acBuf, '\n') && !feof(fExclude)) { fatal("Exclude file line %d was too long to read. Exiting.", iLine); }