Fixed array out of bounds when connection pool is full. Thanks Захар Кравцов!

pull/30/head
Jeroen Domburg 10 years ago
parent 876a68a67d
commit 704d7ad463
  1. 2
      user/httpd.c

@ -450,12 +450,12 @@ static void ICACHE_FLASH_ATTR httpdConnectCb(void *arg) {
//Find empty conndata in pool //Find empty conndata in pool
for (i=0; i<MAX_CONN; i++) if (connData[i].conn==NULL) break; for (i=0; i<MAX_CONN; i++) if (connData[i].conn==NULL) break;
os_printf("Con req, conn=%p, pool slot %d\n", conn, i); os_printf("Con req, conn=%p, pool slot %d\n", conn, i);
connData[i].priv=&connPrivData[i];
if (i==MAX_CONN) { if (i==MAX_CONN) {
os_printf("Aiee, conn pool overflow!\n"); os_printf("Aiee, conn pool overflow!\n");
espconn_disconnect(conn); espconn_disconnect(conn);
return; return;
} }
connData[i].priv=&connPrivData[i];
connData[i].conn=conn; connData[i].conn=conn;
connData[i].priv->headPos=0; connData[i].priv->headPos=0;
connData[i].postBuff=NULL; connData[i].postBuff=NULL;

Loading…
Cancel
Save