diff options
author | Toni <matzeton@googlemail.com> | 2022-06-03 18:21:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 18:21:29 +0200 |
commit | 09fbe0a64a11b08a35435f516e9a19f7e0c20d7c (patch) | |
tree | 3a1f16a822cd21e52da4b9e56486906cb104bb62 /src/include | |
parent | 6149c0f880163b0bebd513fa957ece325c77cb88 (diff) |
Fixed syslog false positives. (#1577)
* syslog: removed unnecessary/unreliable printable string check
* added `ndpi_isalnum()`
* splitted `ndpi_is_printable_string()` into `ndpi_is_printable_buffer()` and `ndpi_normalize_printable_string()`
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_main.h | 3 | ||||
-rw-r--r-- | src/include/ndpi_utils.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/include/ndpi_main.h b/src/include/ndpi_main.h index 4c1f328ac..1dfef4606 100644 --- a/src/include/ndpi_main.h +++ b/src/include/ndpi_main.h @@ -151,7 +151,8 @@ extern "C" { char *risk_message); int ndpi_isset_risk(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, ndpi_risk_enum r); - int ndpi_is_printable_string(char * const str, size_t len); + int ndpi_is_printable_buffer(uint8_t const * const buf, size_t len); + int ndpi_normalize_printable_string(char * const str, size_t len); int ndpi_is_valid_hostname(char * const str, size_t len); #define NDPI_ENTROPY_ENCRYPTED_OR_RANDOM(entropy) (entropy > 7.0f) float ndpi_entropy(u_int8_t const * const buf, size_t len); diff --git a/src/include/ndpi_utils.h b/src/include/ndpi_utils.h index c6605528b..5a31cb426 100644 --- a/src/include/ndpi_utils.h +++ b/src/include/ndpi_utils.h @@ -25,6 +25,7 @@ extern u_int8_t ndpi_ends_with(char *str, char *ends); #define ndpi_isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z')) #define ndpi_isdigit(ch) ((ch) >= '0' && (ch) <= '9') +#define ndpi_isalnum(ch) (ndpi_isalpha(ch) != 0 || ndpi_isdigit(ch) != 0) #define ndpi_isspace(ch) (((ch) >= '\t' && (ch) <= '\r') || ((ch) == ' ')) #define ndpi_isprint(ch) ((ch) >= 0x20 && (ch) <= 0x7e) #define ndpi_ispunct(ch) (((ch) >= '!' && (ch) <= '/') || \ |