summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-11-23 15:29:59 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:20 -0600
commit299bfaa4fd6e36f662fb6de994b71b52c9cfa099 (patch)
tree7e1ad20629beeb0ae0c412a3fae30413d3bd6d55 /qemu-char.c
parentaba0ad4fde5542eb4502e7838fe81d331b03d071 (diff)
downloadhqemu-299bfaa4fd6e36f662fb6de994b71b52c9cfa099.zip
hqemu-299bfaa4fd6e36f662fb6de994b71b52c9cfa099.tar.gz
qemu-char: convert to use error checked base64 decode
Switch from using g_base64_decode over to qbase64_decode in order to get error checking of the base64 input data. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 66703e3..00a7526 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -32,6 +32,7 @@
#include "qapi/qmp-input-visitor.h"
#include "qapi/qmp-output-visitor.h"
#include "qapi-visit.h"
+#include "qemu/base64.h"
#include <unistd.h>
#include <fcntl.h>
@@ -3264,7 +3265,12 @@ void qmp_ringbuf_write(const char *device, const char *data,
}
if (has_format && (format == DATA_FORMAT_BASE64)) {
- write_data = g_base64_decode(data, &write_count);
+ write_data = qbase64_decode(data, -1,
+ &write_count,
+ errp);
+ if (!write_data) {
+ return;
+ }
} else {
write_data = (uint8_t *)data;
write_count = strlen(data);
OpenPOWER on IntegriCloud