Skip to content

Commit

Permalink
Improve note about port name restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Apr 15, 2020
1 parent 917206a commit 5ce9e79
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -31040,8 +31040,13 @@ validate_results_port (const char *port)

/* "cpe:abc", "general/tcp", "20/udp"
*
* The , and ; is to stop users from entering lists of ports.
* CPE doesn't use them because seems like they're valid in CPEs. */
* We keep the "general/tcp" case pretty open because it is not clearly
* restricted anywhere, and is already used with non-alphanumerics in
* "general/Host_Details". We exclude whitespace, ',' and ';' to prevent
* users from entering lists of ports.
*
* Similary, the CPE case forbids whitespace, but allows ',' and ';' as
* these may occur in valid CPEs. */
if (g_regex_match_simple
("^(cpe:[^\\s]+|general/[^\\s,;]+|[0-9]+/[[:alnum:]]+)$",
port, 0, 0)
Expand Down

0 comments on commit 5ce9e79

Please sign in to comment.