From d568eccd4c4857109c5e34163b413e7dfe1451a0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 13 Dec 2024 09:18:16 +0000 Subject: [PATCH] spa: use sized local info rather than incoming We allow a default 0 length in the incoming const info to mean a default size (of 512). We implement it by copying the incoming const info to a copy in the spa that we can adapt, which is all good. But in two cases after we dumbly use the incoming const info directly instead of the adapted copy. https://github.com/warmcat/libwebsockets/issues/3294 --- lib/roles/http/server/lws-spa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/roles/http/server/lws-spa.c b/lib/roles/http/server/lws-spa.c index f24f417af..6d13b1f0b 100644 --- a/lib/roles/http/server/lws-spa.c +++ b/lib/roles/http/server/lws-spa.c @@ -586,7 +586,7 @@ lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *i) if (!spa->storage) goto bail2; - spa->end = spa->storage + i->max_storage - 1; + spa->end = spa->storage + spa->i.max_storage - 1; if (i->count_params) { if (i->ac) @@ -599,7 +599,7 @@ lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *i) goto bail3; } - spa->s = lws_urldecode_s_create(spa, wsi, spa->storage, i->max_storage, + spa->s = lws_urldecode_s_create(spa, wsi, spa->storage, spa->i.max_storage, lws_urldecode_spa_cb); if (!spa->s) goto bail4;