diff options
| author | Richard W.M. Jones <rjones@redhat.com> | 2012-02-13 08:58:04 +0000 |
|---|---|---|
| committer | Richard W.M. Jones <rjones@redhat.com> | 2012-02-13 15:44:25 +0000 |
| commit | 563a801bf788c60f7efa31ebae1a9a005b8bff09 (patch) | |
| tree | 147825e87b7397e0022432642287f9ca482aba79 /python | |
| parent | 68ce3b9db24b797022e011c375cf245cd7b6e732 (diff) | |
| download | libguestfs-563a801bf788c60f7efa31ebae1a9a005b8bff09.tar.gz libguestfs-563a801bf788c60f7efa31ebae1a9a005b8bff09.tar.xz libguestfs-563a801bf788c60f7efa31ebae1a9a005b8bff09.zip | |
daemon: Don't xdr_free uninitialized args struct on error paths.
For stubs of functions that had arguments, code did this:
static void
mount_stub (XDR *xdr_in)
{
int r;
struct guestfs_mount_args args;
if (optargs_bitmask != 0) {
//...
goto done;
}
// possibly other tests here
memset (&args, 0, sizeof args);
[...]
done:
xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
return;
}
This caused xdr_free to be called on uninitialized 'args' struct,
causing a segfault.
The fix is to add another label, so the code looks like:
static void
mount_stub (XDR *xdr_in)
{
int r;
struct guestfs_mount_args args;
if (optargs_bitmask != 0) {
//...
goto done_no_free;
}
// possibly other tests here
memset (&args, 0, sizeof args);
[...]
done:
xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
done_no_free:
return;
}
This fixes commit 330fbea5b2d6bd7db84f7ea7afe87cf1bcd438e0
and commit 0344248af55802bbbd816b349ec1ba9305996f6e.
(cherry picked from commit ba443ae0486ae30ea597c4e126de63371f8fa7a8)
Diffstat (limited to 'python')
0 files changed, 0 insertions, 0 deletions
