From b5e63ca44c846813ece9ad9df684cae0d1d5b542 Mon Sep 17 00:00:00 2001 From: Mike Ajax <14773392+michaelajax@users.noreply.github.com> Date: Thu, 23 Apr 2026 22:00:53 -0700 Subject: typec/stm32: guard hard reset RX re-arm against uninitialized buffer --- src/portable/st/typec/typec_stm32.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/portable/st/typec/typec_stm32.c b/src/portable/st/typec/typec_stm32.c index fe9275245..d7e622925 100644 --- a/src/portable/st/typec/typec_stm32.c +++ b/src/portable/st/typec/typec_stm32.c @@ -342,8 +342,10 @@ void tcd_int_handler(uint8_t rhport) { // flag will remain set and re-enter the ISR immediately if (sr & UCPD_SR_RXHRSTDET) { TU_LOG3("Hard Reset received\r\n"); - dma_stop(rhport, true); - tcd_msg_receive(rhport, _rx_buf, _rx_buf_len); + if (_rx_buf != NULL && _rx_buf_len > 0) { + dma_stop(rhport, true); + tcd_msg_receive(rhport, _rx_buf, _rx_buf_len); + } UCPD1->ICR = UCPD_ICR_RXHRSTDETCF; } -- cgit v1.3.1