mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +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:
parent
eccc235d5a
commit
a0f101cb5c
1 changed files with 10 additions and 5 deletions
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue