From: Dave Barach Date: Wed, 7 Dec 2022 00:53:15 +0000 (-0500) Subject: http_static: misc bug fixes X-Git-Tag: v23.06-rc0~84 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=287c1252c1c2ed5e3153f3dfab530456edfa9322;p=vpp.git http_static: misc bug fixes The request vector generated by hss_ts_rx_callback() must be NULL terminated. The hss_main_t use_ptr_thresh member must be a u64 since unformat_memory_size() expects it. Otherwise, the adjacent u8 enable_url_handlers may have an accident. Type: fix Signed-off-by: Dave Barach Change-Id: I2cc08e3cbd31b225fb03799283c055515add13bf --- diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h index 4e038ed385d..5ea1a6eab8f 100644 --- a/src/plugins/http_static/http_static.h +++ b/src/plugins/http_static/http_static.h @@ -145,7 +145,7 @@ typedef struct /** The bind URI, defaults to tcp://0.0.0.0/80 */ u8 *uri; /** Threshold for switching to ptr data in http msgs */ - u32 use_ptr_thresh; + u64 use_ptr_thresh; /** Enable the use of builtinurls */ u8 enable_url_handlers; /** Max cache size before LRU occurs */ diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c index a4c62fcda07..a76cb87a2ce 100644 --- a/src/plugins/http_static/static_server.c +++ b/src/plugins/http_static/static_server.c @@ -384,6 +384,8 @@ hss_ts_rx_callback (session_t *ts) vec_validate (request, msg.data.len - 1); rv = svm_fifo_dequeue (ts->rx_fifo, msg.data.len, request); ASSERT (rv == msg.data.len); + /* request must be a proper C-string in addition to a vector */ + vec_add1 (request, 0); } /* Find and send data */