diff --git a/src/h3.c b/src/h3.c index afcefef59..20f202c2e 100644 --- a/src/h3.c +++ b/src/h3.c @@ -93,7 +93,9 @@ static inline size_t h3_decode_frm_header(uint64_t *ftype, uint64_t *flen, return hlen; } -/* Decode remotely initiated bidi-stream */ +/* Decode remotely initiated bidi-stream. + * Returns <0 on error else 0. + */ static int h3_decode_qcs(struct qcs *qcs, void *ctx) { struct buffer *rxbuf = &qcs->rx.buf; @@ -171,6 +173,8 @@ static int h3_decode_qcs(struct qcs *qcs, void *ctx) flags |= HTX_SL_F_VER_11; sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, path, ist("HTTP/3.0")); + if (!sl) + goto fail; sl->flags |= HTX_SL_F_BODYLESS; sl->info.req.meth = find_http_meth(meth.ptr, meth.len); BUG_ON(sl->info.req.meth == HTTP_METH_OTHER); @@ -215,7 +219,10 @@ static int h3_decode_qcs(struct qcs *qcs, void *ctx) b_del(rxbuf, flen); } - return 1; + return 0; + + fail: + return -1; } /* Parse a SETTINGS frame which must not be truncated with as length from diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 9dec844e5..09722c063 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -1828,7 +1828,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt, goto store_frm; ret = qc_strm_cpy(&strm->rx.buf, strm_frm); - if (ret && qc->qcc->app_ops->decode_qcs(strm, qc->qcc->ctx) == -1) { + if (ret && qc->qcc->app_ops->decode_qcs(strm, qc->qcc->ctx) < 0) { TRACE_PROTO("Decoding error", QUIC_EV_CONN_PSTRM); return 0; }