Procházet zdrojové kódy

Fix coverity warnings

bel2125 před 8 roky
rodič
revize
1693df8d2c
2 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 1 1
      src/civetweb.c
  2. 7 0
      src/handle_form.inl

+ 1 - 1
src/civetweb.c

@@ -12259,7 +12259,7 @@ refresh_trust(struct mg_connection *conn)
 	if (chain == NULL) {
 		chain = pem;
 	}
-	if (*chain == 0) {
+	if ((chain != NULL) && (*chain == 0)) {
 		chain = NULL;
 	}
 

+ 7 - 0
src/handle_form.inl

@@ -545,10 +545,17 @@ mg_handle_form_request(struct mg_connection *conn,
 		if (boundary[0] == '"') {
 			/* RFC 2046 permits the boundary string to be quoted. */
 			hbuf = strchr(boundary + 1, '"');
+			if (!hbuf) {
+				/* Malformed request */
+				return -1;
+			}
 			if (*hbuf) {
 				*hbuf = 0;
 				boundary++;
 				bl = strlen(boundary);
+			} else {
+				/* Malformed request */
+				return -1;
 			}
 		}