mirror of
https://github.com/nmap/nmap.git
synced 2026-08-27 03:48:14 +00:00
Whoops, we can't free something allocated with cp_alloc. Handle it another way.
This commit is contained in:
parent
1058a9bfd9
commit
214c29c80b
1 changed files with 8 additions and 7 deletions
15
osscan.cc
15
osscan.cc
|
|
@ -810,7 +810,7 @@ static char *substrstrip(const char *p, const char *q) {
|
|||
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
while (q >p && isspace(*(q - 1)))
|
||||
while (q > p && isspace(*(q - 1)))
|
||||
q--;
|
||||
|
||||
s = (char *) cp_alloc(q - p + 1);
|
||||
|
|
@ -855,13 +855,14 @@ static void parse_classline(FingerPrint *FP, char *thisline, int lineno,
|
|||
end = strchr(begin, '|');
|
||||
if (end == NULL)
|
||||
fatal("Parse error on line %d of fingerprint: %s\n", lineno, thisline);
|
||||
os_class->OS_Generation = substrstrip(begin, end);
|
||||
/* OS generation is a special case: in the case of an empty string it is made
|
||||
NULL. */
|
||||
if (os_class->OS_Generation[0] == '\0') {
|
||||
free(os_class->OS_Generation);
|
||||
/* OS generation is handled specially: instead of an empty string it's
|
||||
supposed to be NULL. */
|
||||
while (isspace(*begin))
|
||||
begin++;
|
||||
if (begin < end)
|
||||
os_class->OS_Generation = substrstrip(begin, end);
|
||||
else
|
||||
os_class->OS_Generation = NULL;
|
||||
}
|
||||
|
||||
/* And finally the device type. We look for '\0' instead of '|'. */
|
||||
begin = end + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue