From dc65edd519c2cedee43d6e5114783b5edfbd61c4 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 ea5d4abd7..a762be59e 100644 --- a/lib/roles/http/server/lws-spa.c +++ b/lib/roles/http/server/lws-spa.c @@ -570,7 +570,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) @@ -583,7 +583,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;