mirror of
https://github.com/nmap/nmap.git
synced 2025-12-26 17:39:03 +00:00
Don't use strtok to parse the argument to --script. Because strtok
inserts null characters it was effectively truncating the option argument value after it was done with it. So --script=a,b,c would become --script=a in log files.
This commit is contained in:
15
NmapOps.cc
15
NmapOps.cc
@@ -563,12 +563,17 @@ void NmapOps::setSpoofMACAddress(u8 *mac_data) {
|
||||
|
||||
#ifndef NOLUA
|
||||
void NmapOps::chooseScripts(char* argument) {
|
||||
char *ap;
|
||||
char *p;
|
||||
|
||||
ap = strtok(argument, ",");
|
||||
while(ap != NULL) {
|
||||
chosenScripts.push_back(std::string(ap));
|
||||
ap = strtok(NULL, ",");
|
||||
for (;;) {
|
||||
p = strchr(argument, ',');
|
||||
if (p == NULL) {
|
||||
chosenScripts.push_back(std::string(argument));
|
||||
break;
|
||||
} else {
|
||||
chosenScripts.push_back(std::string(argument, p - argument));
|
||||
argument = p + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user