浏览代码

Truly allow all non-control characters in URIs

Signed-off-by: DL6ER <dl6er@dl6er.de>
DL6ER 1 年之前
父节点
当前提交
2d7d597486
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/civetweb.c

+ 3 - 2
src/civetweb.c

@@ -10843,8 +10843,9 @@ static int
 skip_to_end_of_word_and_terminate(char **ppw, int eol)
 {
 	/* Forward until a space is found - use isgraph here */
+	/* Extended ASCII characters are also treated as word characters. */
 	/* See http://www.cplusplus.com/reference/cctype/ */
-	while (isgraph((unsigned char)**ppw)) {
+	while ((unsigned char)**ppw > 127 || isgraph((unsigned char)**ppw)) {
 		(*ppw)++;
 	}
 
@@ -18639,7 +18640,7 @@ get_uri_type(const char *uri)
 	 * and % encoded symbols.
 	 */
 	for (i = 0; uri[i] != 0; i++) {
-		if (uri[i] < 33) {
+		if ((unsigned char)uri[i] < 33) {
 			/* control characters and spaces are invalid */
 			return 0;
 		}