winedbg: Force read data to be NUL terminated.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3192fb5396
commit
46ec0b956d
|
@ -1848,12 +1848,14 @@ static int fetch_data(struct gdb_context* gdbctx)
|
||||||
if (gdbctx->in_len + STEP > gdbctx->in_buf_alloc)
|
if (gdbctx->in_len + STEP > gdbctx->in_buf_alloc)
|
||||||
gdbctx->in_buf = packet_realloc(gdbctx->in_buf, gdbctx->in_buf_alloc += STEP);
|
gdbctx->in_buf = packet_realloc(gdbctx->in_buf, gdbctx->in_buf_alloc += STEP);
|
||||||
#undef STEP
|
#undef STEP
|
||||||
len = read(gdbctx->sock, gdbctx->in_buf + gdbctx->in_len, gdbctx->in_buf_alloc - gdbctx->in_len);
|
len = read(gdbctx->sock, gdbctx->in_buf + gdbctx->in_len, gdbctx->in_buf_alloc - gdbctx->in_len - 1);
|
||||||
if (len <= 0) break;
|
if (len <= 0) break;
|
||||||
gdbctx->in_len += len;
|
gdbctx->in_len += len;
|
||||||
assert(gdbctx->in_len <= gdbctx->in_buf_alloc);
|
assert(gdbctx->in_len <= gdbctx->in_buf_alloc);
|
||||||
if (len < gdbctx->in_buf_alloc - gdbctx->in_len) break;
|
if (len < gdbctx->in_buf_alloc - gdbctx->in_len) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdbctx->in_buf[gdbctx->in_len] = '\0';
|
||||||
return gdbctx->in_len - in_len;
|
return gdbctx->in_len - in_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue