diff options
author | Michele Campus <fci1908@gmail.com> | 2016-09-13 10:51:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-13 10:51:35 +0200 |
commit | 6b4b7a9083aa60c803f78540d16cc07f3c419f60 (patch) | |
tree | 841d21e052a6d64d05f1304112805abb90b261db /src | |
parent | 3cd64563496c32981bce3d511ba4a2b460a44111 (diff) | |
parent | afcf56753877a2e733dfdb8e783ca96f87d2f409 (diff) |
Merge pull request #265 from tianzhishuizhu/dev
improve readability
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/protocols/syslog.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/protocols/syslog.c b/src/lib/protocols/syslog.c index ffd897221..589f40f21 100644 --- a/src/lib/protocols/syslog.c +++ b/src/lib/protocols/syslog.c @@ -46,15 +46,14 @@ void ndpi_search_syslog(struct ndpi_detection_module_struct if (packet->payload_packet_len > 20 && packet->payload_packet_len <= 1024 && packet->payload[0] == '<') { NDPI_LOG(NDPI_PROTOCOL_SYSLOG, ndpi_struct, NDPI_LOG_DEBUG, "checked len>20 and <1024 and first symbol=<.\n"); - i = 1; - for (;;) { - if (packet->payload[i] < '0' || packet->payload[i] > '9' || i++ > 3) { - NDPI_LOG(NDPI_PROTOCOL_SYSLOG, ndpi_struct, NDPI_LOG_DEBUG, - "read symbols while the symbol is a number.\n"); - break; + for (i = 1; i <= 3; i++) { + if (packet->payload[i] < '0' || packet->payload[i] > '9') { + break; } } + NDPI_LOG(NDPI_PROTOCOL_SYSLOG, ndpi_struct, NDPI_LOG_DEBUG, + "read symbols while the symbol is a number.\n"); if (packet->payload[i++] != '>') { NDPI_LOG(NDPI_PROTOCOL_SYSLOG, ndpi_struct, NDPI_LOG_DEBUG, "there is no > following the number.\n"); |