1
0
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:
david
2009-03-31 04:32:38 +00:00
parent eccc235d5a
commit a0f101cb5c

View File

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