From b68bd23d9b0e1e64212a73cb7412368eee4d9aa4 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 20 Apr 2006 14:28:01 +0000 Subject: [PATCH] * src/xend_internal.c: fix an uninitialized memory access in error reporting. Daniel --- ChangeLog | 5 +++++ src/xend_internal.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95dcb79595..bfbb11928e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Apr 20 14:31:13 EDT 2006 Daniel Veillard + + * src/xend_internal.c: fix an uninitialized memory access in error + reporting. + Thu Apr 13 17:19:25 EDT 2006 Daniel Veillard * include/libvirt.h include/libvirt.h.in doc/*: added new entry point diff --git a/src/xend_internal.c b/src/xend_internal.c index cb0ef70db2..1bea597f46 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -395,9 +395,9 @@ xend_req(int fd, char *content, size_t n_content) if (0 > (int) ret) return -1; - content[nbuf + ret + 1] = '\0'; + content[nbuf + ret] = 0; } else { - content[nbuf + 1] = '\0'; + content[nbuf] = 0; } } else { /* Unable to complete reading header */ content[0] = 0; @@ -489,6 +489,9 @@ xend_post(virConnectPtr xend, const char *path, const char *ops, if ((ret < 0) || (ret >= 300)) { virXendError(NULL, VIR_ERR_POST_FAILED, content); + } else if ((ret = 202) && (strstr(content, "failed") != NULL)) { + virXendError(NULL, VIR_ERR_POST_FAILED, content); + ret = -1; } return ret;