Skip to content

Commit fe559a4

Browse files
authored
fix: prevent int underflow in link write (#935)
1 parent 04c906d commit fe559a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/link/link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ z_result_t _z_link_send_wbuf(const _z_link_t *link, const _z_wbuf_t *wbf, _z_sys
182182
size_t n = bs.len;
183183
do {
184184
size_t wb = link->_write_f(link, bs.start, n, socket);
185-
if (wb == SIZE_MAX) {
185+
if ((wb == SIZE_MAX) || (wb > n)) {
186186
ret = _Z_ERR_TRANSPORT_TX_FAILED;
187187
break;
188188
}

0 commit comments

Comments
 (0)