From 566fe47d884d0e5c59b942653fa049f235232a5b Mon Sep 17 00:00:00 2001 From: "yongk.kim" Date: Thu, 21 Nov 2019 14:19:47 +0900 Subject: [PATCH] [#128] fix other problems related #128 --- parser.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/parser.c b/parser.c index f729481..153e9c3 100644 --- a/parser.c +++ b/parser.c @@ -1230,7 +1230,8 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len) res = 0; - do { + for (; i < len - 1; i++, ch = data[i]) { + log_debug("[%p] s_check_uri", p); if (usual[ch >> 5] & (1 << (ch & 0x1f))) { @@ -1239,12 +1240,7 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len) break; } - if (evhtp_unlikely(i + 1 >= len)) { - break; - } - - ch = data[++i]; - } while (i < len); + } switch (ch) { case ' ': @@ -1316,19 +1312,13 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len) res = 0; - do { + for (; i < len - 1; i++, ch = data[i]) { if (usual[ch >> 5] & (1 << (ch & 0x1f))) { HTP_SET_BUF(ch); } else { break; } - - if (evhtp_unlikely(i + 1 >= len)) { - break; - } - - ch = data[++i]; - } while (i < len); + } switch (ch) { case ' ':