From 944f4ce6f093376a0519e2d247be045f4e950f96 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Mon, 31 Aug 2026 23:26:37 +0200 Subject: [PATCH] sfp: stop the web pages printing the previous slot's bytes An empty slot used to read back 0xa0 per byte and the filter dropped it, so the field came out empty. Block reads report the failure instead and leave the buffer alone, and these two callers ignored that and printed what the last successful read had left there. Say nothing when there is nothing to read, which is what the other eight callers of sfp_read_block() already do. --- httpd/page_impl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/httpd/page_impl.c b/httpd/page_impl.c index 2f94568..e04979f 100644 --- a/httpd/page_impl.c +++ b/httpd/page_impl.c @@ -178,8 +178,8 @@ void send_sfp_info(uint8_t sfp) { // This loops over the Vendor-name, Vendor OUI, Vendor PN and Vendor rev ASCII fields for (uint8_t i = 16; i < 64; i++) { - if (!(i & 0xf)) - sfp_read_block(sfp, i, 16); + if (!(i & 0xf) && !sfp_read_block(sfp, i, 16)) + return; if (i < 20 || i >= 60 || (i >= 36 && i < 40)) // Skip Non-ASCII codes continue; uint8_t c = sfp_buf[i & 0xf]; @@ -195,7 +195,8 @@ void sfp_send_data(uint8_t slot, uint8_t reg, uint8_t len) if (len > 16) return; - sfp_read_block(slot, reg, len); + if (!sfp_read_block(slot, reg, len)) + return; for (uint8_t i = 0; i < len; i++) byte_to_html(sfp_buf[i]);