fix for bug #69076, fix handling of URLs with lone '?' as last character
[m6w6/ext-http] / php_http_url.c
index 951af23993d0e4bd7415edd5d84786138a2f1e6e..14ad6f7067b6444577571e8046e17e0f7b71979c 100644 (file)
@@ -1271,7 +1271,7 @@ static const char *parse_query(struct parse_state *state)
        tmp = ++state->ptr;
        state->url.query = &state->buffer[state->offset];
 
-       do {
+       while(state->ptr < state->end) {
                switch (*state->ptr) {
                case '#':
                        goto done;
@@ -1323,7 +1323,9 @@ static const char *parse_query(struct parse_state *state)
                        }
                        state->ptr += mb - 1;
                }
-       } while (++state->ptr < state->end);
+
+               ++state->ptr;
+       }
 
        done:
        state->buffer[state->offset++] = 0;