mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Skip whole quoted program name when parsing args with --resume
This commit is contained in:
24
nmap.cc
24
nmap.cc
@@ -2297,8 +2297,30 @@ int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv) {
|
|||||||
p += 5;
|
p += 5;
|
||||||
else
|
else
|
||||||
fatal("Unable to parse supposed log file %s. Are you sure this is an Nmap output file?", fname);
|
fatal("Unable to parse supposed log file %s. Are you sure this is an Nmap output file?", fname);
|
||||||
while (*p && !isspace((int) (unsigned char) *p))
|
/* Skip the program name */
|
||||||
|
while (*p && !isspace((int) (unsigned char) *p)){
|
||||||
|
if (*p == '"' || *p == '\'') {
|
||||||
|
/* Quoted, so find the matching quote.
|
||||||
|
* TODO:Doesn't handle escaped quotes, but we don't generate them either. */
|
||||||
|
p = strchr(p+1, *p);
|
||||||
|
if (!p) {
|
||||||
|
fatal("Unable to parse supposed log file %s: unclosed quote.", fname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strncasecmp(p, """, 6)) {
|
||||||
|
/* We do XML unescaping later, but this is just special case of quoted
|
||||||
|
* program name. */
|
||||||
|
do {
|
||||||
|
p = strstr(p+1, "&");
|
||||||
|
if (!p) {
|
||||||
|
fatal("Unable to parse supposed log file %s: unclosed quote.", fname);
|
||||||
|
}
|
||||||
|
} while (strncasecmp(p, """, 6));
|
||||||
|
/* Only skip to the ';', because another increment happens below. */
|
||||||
|
p += 5;
|
||||||
|
}
|
||||||
p++;
|
p++;
|
||||||
|
}
|
||||||
if (!*p)
|
if (!*p)
|
||||||
fatal("Unable to parse supposed log file %s. Sorry", fname);
|
fatal("Unable to parse supposed log file %s. Sorry", fname);
|
||||||
p++; /* Skip the space between program name and first arg */
|
p++; /* Skip the space between program name and first arg */
|
||||||
|
|||||||
Reference in New Issue
Block a user