소스 검색

Ignore parameters for APPLICATION/X-WWW-FORM-URLENCODED contents (#651)

bel2125 6 년 전
부모
커밋
ee2f3bd199
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      src/civetweb.c
  2. 6 2
      src/handle_form.inl

+ 1 - 1
src/civetweb.c

@@ -2975,7 +2975,7 @@ mg_set_thread_name(const char *name)
 #endif
 #endif
 #elif defined(_GNU_SOURCE) && defined(__GLIBC__)                               \
 #elif defined(_GNU_SOURCE) && defined(__GLIBC__)                               \
     && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
     && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
-	/* pthread_setname_np first appeared in glibc in version 2.12*/
+/* pthread_setname_np first appeared in glibc in version 2.12*/
 #if defined(__MACH__)
 #if defined(__MACH__)
 	/* OS X only current thread name can be changed */
 	/* OS X only current thread name can be changed */
 	(void)pthread_setname_np(threadName);
 	(void)pthread_setname_np(threadName);

+ 6 - 2
src/handle_form.inl

@@ -357,8 +357,12 @@ mg_handle_form_request(struct mg_connection *conn,
 	content_type = mg_get_header(conn, "Content-Type");
 	content_type = mg_get_header(conn, "Content-Type");
 
 
 	if (!content_type
 	if (!content_type
-	    || !mg_strcasecmp(content_type, "APPLICATION/X-WWW-FORM-URLENCODED")
-	    || !mg_strcasecmp(content_type, "APPLICATION/WWW-FORM-URLENCODED")) {
+	    || !mg_strncasecmp(content_type,
+	                       "APPLICATION/X-WWW-FORM-URLENCODED",
+	                       33)
+	    || !mg_strncasecmp(content_type,
+	                       "APPLICATION/WWW-FORM-URLENCODED",
+	                       31)) {
 		/* The form data is in the request body data, encoded in key/value
 		/* The form data is in the request body data, encoded in key/value
 		 * pairs. */
 		 * pairs. */
 		int all_data_read = 0;
 		int all_data_read = 0;