diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-11-24 14:17:35 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-11-24 14:17:35 +0000 |
commit | a4c0d7a82a906ed5213740227efc279d3e557165 (patch) | |
tree | 113a66d13da33806e072b84c0a6b0c0a10bdf09b /python/examples/inspect_vm.py | |
parent | aeea803ad0fafe1ed4c7f8e781dfe4fdc150cac0 (diff) | |
download | libguestfs-a4c0d7a82a906ed5213740227efc279d3e557165.tar.gz libguestfs-a4c0d7a82a906ed5213740227efc279d3e557165.tar.xz libguestfs-a4c0d7a82a906ed5213740227efc279d3e557165.zip |
launch: appliance: Handle non-\0 terminated buffer correctly.
The read_all function is used as a callback for
guestfs___cmd_set_stdout_callback (cmd, read_all, [str],
CMD_STDOUT_FLAG_WHOLE_BUFFER);
As noted in the documentation for CMD_STDOUT_FLAG_WHOLE_BUFFER, the
buffer returned is not \0-terminated, and so using memdup will create
an unterminated string, and therefore potentially a memory overrun
when reading or searching the string.
Use strndup instead so the final string is \0-terminated.
Diffstat (limited to 'python/examples/inspect_vm.py')
0 files changed, 0 insertions, 0 deletions