1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 12:41:29 +00:00

Add patch from Henri Doreau that makes --excludefile properly handle files with

no terminating newline.
This commit is contained in:
david
2009-01-14 22:20:18 +00:00
parent 6f56ebfc22
commit aef760f2f3
2 changed files with 7 additions and 2 deletions

View File

@@ -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

View File

@@ -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);
}