]> xenbits.xensource.com Git - xen.git/commit
libxl: qmp: ensure qmp read buffer is NULL terminated
authorIan Campbell <ian.campbell@citrix.com>
Wed, 17 Feb 2016 11:02:20 +0000 (11:02 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 1 Mar 2016 16:17:36 +0000 (16:17 +0000)
commitc1a8556f0c814a799e565186099da263e9ebdf14
tree74aece0d866c531529004e557bc2574961102f41
parent8891dccfed78c6ee03b8912ed5353b83595a9549
libxl: qmp: ensure qmp read buffer is NULL terminated

Coverity rightly points out that qmp->buffer may not be NULL
terminated when passed to strncat.

Make the actual buffer a byte bigger than QMP_RECEIVE_BUFFER_SIZE and
always append a NULL byte.

I suspect that in practice we have not yet seen QMP messages
approaching the buffer size (4K).

Compile tested only.

CID: 1055989

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_qmp.c