Codebase list libhtp / 18e1b74
New upstream version 0.5.36 Sascha Steinbiss 3 years ago
4 changed file(s) with 32 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
0 0.5.36 (3 December 2020)
1 ------------------------
2
3 - fix a http pipelining issue (#304, fixed by #312)
4
05 0.5.35 (8 October 2020)
6 -----------------------
17
28 - fix memory leak in tunnel traffoc
39
00 # This file is intended to be sourced by sh
1 PKG_VERSION=0.5.35
1 PKG_VERSION=0.5.36
842842 }
843843 if (connp->in_next_byte != LF || connp->in_current_consume_offset >= connp->in_current_read_offset) {
844844 for (;;) {//;i < max_read; i++) {
845 IN_COPY_BYTE_OR_RETURN(connp);
846 // Have we reached the end of the line? For some reason
847 // we can't test after IN_COPY_BYTE_OR_RETURN */
845 // peek until LF but do not mark it read so that REQ_LINE works
846 IN_PEEK_NEXT(connp);
848847 if (connp->in_next_byte == LF)
849848 break;
849 IN_COPY_BYTE_OR_RETURN(connp);
850850 }
851851 }
852852 }
876876 while ((pos < len) && (!htp_is_space(data[pos])))
877877 pos++;
878878
879 if (pos <= mstart) {
880 //empty whitespace line
881 htp_status_t rc = htp_tx_req_process_body_data_ex(connp->in_tx, data, len);
882 htp_connp_req_clear_buffer(connp);
883 return rc;
884 } else {
879 if (pos > mstart) {
880 //non empty whitespace line
885881 int methodi = HTP_M_UNKNOWN;
886882 bstr *method = bstr_dup_mem(data + mstart, pos - mstart);
887883 if (method) {
888884 methodi = htp_convert_method_to_number(method);
889885 bstr_free(method);
890886 }
891 if (methodi == HTP_M_UNKNOWN) {
892 if (connp->in_body_data_left <= 0) {
893 // log only once per transaction
894 htp_log(connp, HTP_LOG_MARK, HTP_LOG_WARNING, 0, "Unexpected request body");
895 } else {
896 connp->in_body_data_left = 1;
897 }
898 // Interpret remaining bytes as body data
899 htp_status_t rc = htp_tx_req_process_body_data_ex(connp->in_tx, data, len);
900 htp_connp_req_clear_buffer(connp);
901 return rc;
887 if (methodi != HTP_M_UNKNOWN) {
888 connp->in_body_data_left = -1;
889 return htp_tx_state_request_complete(connp->in_tx);
902890 } // else continue
903 connp->in_body_data_left = -1;
904 }
905 //unread last end of line so that REQ_LINE works
906 if (connp->in_current_read_offset < (int64_t)len) {
907 connp->in_current_read_offset=0;
908 } else {
909 connp->in_current_read_offset-=len;
910 }
911 if (connp->in_current_read_offset < connp->in_current_consume_offset) {
912 connp->in_current_consume_offset=connp->in_current_read_offset;
913 }
914
915 return htp_tx_state_request_complete(connp->in_tx);
891 if (connp->in_body_data_left <= 0) {
892 // log only once per transaction
893 htp_log(connp, HTP_LOG_MARK, HTP_LOG_WARNING, 0, "Unexpected request body");
894 } else {
895 connp->in_body_data_left = 1;
896 }
897 }
898 //Adds linefeed to the buffer if there was one
899 if (connp->in_next_byte == LF) {
900 IN_COPY_BYTE_OR_RETURN(connp);
901 htp_connp_req_consolidate_data(connp, &data, &len);
902 }
903 // Interpret remaining bytes as body data
904 htp_status_t rc = htp_tx_req_process_body_data_ex(connp->in_tx, data, len);
905 htp_connp_req_clear_buffer(connp);
906 return rc;
916907 }
917908
918909 htp_status_t htp_connp_REQ_IGNORE_DATA_AFTER_HTTP_0_9(htp_connp_t *connp) {
19751975 */
19761976 void fprint_raw_data(FILE *stream, const char *name, const void *data, size_t len) {
19771977 // may happen for gaps
1978 if (data == NULL && len > 0) {
1978 if (data == NULL) {
19791979 fprintf(stream, "\n%s: ptr NULL len %u\n", name, (unsigned int)len);
19801980 } else {
19811981 fprint_raw_data_ex(stream, name, data, 0, len);