From: Richard Jones Date: Sun, 5 Jul 2009 15:04:50 +0000 (+0100) Subject: Don't die if reply message is oversized (RHBZ#509597). X-Git-Tag: 1.0.56~8^2~11 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=51d0620ad90f913cb749e641a839876b3ef755f8;ds=sidebyside Don't die if reply message is oversized (RHBZ#509597). --- diff --git a/daemon/proto.c b/daemon/proto.c index 62871b5..acd6601 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -266,9 +266,14 @@ reply (xdrproc_t xdrp, char *ret) } if (xdrp) { + /* This can fail if the reply body is too large, for example + * if it exceeds the maximum message size. In that case + * we want to return an error message instead. (RHBZ#509597). + */ if (!(*xdrp) (&xdr, ret)) { - fprintf (stderr, "guestfsd: failed to encode reply body\n"); - exit (1); + reply_with_perror ("guestfsd: failed to encode reply body\n"); + xdr_destroy (&xdr); + return; } }