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:
@@ -1,5 +1,9 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# 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
|
o Nsock handles a certain Windows connect error, WSAEADDRNOTAVAIL
|
||||||
(errno 10049), preventing an assertion failure that looked like
|
(errno 10049), preventing an assertion failure that looked like
|
||||||
Strange connect error from 203.65.42.255 (10049): No such file or directory
|
Strange connect error from 203.65.42.255 (10049): No such file or directory
|
||||||
|
|||||||
@@ -283,7 +283,8 @@ TargetGroup* load_exclude(FILE *fExclude, char *szExclude) {
|
|||||||
* in the file, and reset the file */
|
* in the file, and reset the file */
|
||||||
if (1 == b_file) {
|
if (1 == b_file) {
|
||||||
while ((char *)0 != fgets(acBuf,sizeof(acBuf), fExclude)) {
|
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);
|
fatal("Exclude file line %d was too long to read. Exiting.", iLine);
|
||||||
}
|
}
|
||||||
pc=strtok(acBuf, "\t\n ");
|
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 */
|
/* If we are parsing a file load the exclude list from that */
|
||||||
while ((char *)0 != fgets(acBuf, sizeof(acBuf), fExclude)) {
|
while ((char *)0 != fgets(acBuf, sizeof(acBuf), fExclude)) {
|
||||||
++iLine;
|
++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);
|
fatal("Exclude file line %d was too long to read. Exiting.", iLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user