瀏覽代碼

Fix static source code analysis warnings

bel2125 7 年之前
父節點
當前提交
c72d313346
共有 2 個文件被更改,包括 5 次插入11 次删除
  1. 4 2
      src/civetweb.c
  2. 1 9
      src/handle_form.inl

+ 4 - 2
src/civetweb.c

@@ -11621,7 +11621,6 @@ mg_websocket_write_exec(struct mg_connection *conn,
 		headerLen += 4;
 		headerLen += 4;
 	}
 	}
 
 
-
 	/* Note that POSIX/Winsock's send() is threadsafe
 	/* Note that POSIX/Winsock's send() is threadsafe
 	 * http://stackoverflow.com/questions/1981372/are-parallel-calls-to-send-recv-on-the-same-socket-valid
 	 * http://stackoverflow.com/questions/1981372/are-parallel-calls-to-send-recv-on-the-same-socket-valid
 	 * but mongoose's mg_printf/mg_write is not (because of the loop in
 	 * but mongoose's mg_printf/mg_write is not (because of the loop in
@@ -14537,7 +14536,10 @@ ssl_servername_callback(SSL *ssl, int *ad, void *arg)
 
 
 	(void)ad;
 	(void)ad;
 
 
-	DEBUG_ASSERT(conn->phys_ctx == ctx);
+	if ((ctx == NULL) || (conn->phys_ctx == ctx)) {
+		DEBUG_TRACE("%s", "internal error - assertion failed");
+		return SSL_TLSEXT_ERR_NOACK;
+	}
 
 
 	/* Old clients (Win XP) will not support SNI. Then, there
 	/* Old clients (Win XP) will not support SNI. Then, there
 	 * is no server name available in the request - we can
 	 * is no server name available in the request - we can

+ 1 - 9
src/handle_form.inl

@@ -882,15 +882,7 @@ mg_handle_form_request(struct mg_connection *conn,
 				}
 				}
 				buf_fill += r;
 				buf_fill += r;
 				buf[buf_fill] = 0;
 				buf[buf_fill] = 0;
-				if (buf_fill < 1) {
-					/* No data */
-					if (fstore.access.fp) {
-						mg_fclose(&fstore.access);
-						remove_bad_file(conn, path);
-					}
-					mg_free(boundary);
-					return -1;
-				}
+				/* buf_fill is at least 8 here */
 
 
 				/* Find boundary */
 				/* Find boundary */
 				next = search_boundary(buf, (size_t)buf_fill, boundary, bl);
 				next = search_boundary(buf, (size_t)buf_fill, boundary, bl);