aboutsummaryrefslogtreecommitdiff
path: root/block/nbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/nbd.c')
-rw-r--r--block/nbd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 123976171c..5f18f78a94 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1832,6 +1832,10 @@ static int nbd_process_options(BlockDriverState *bs, QDict *options,
}
s->export = g_strdup(qemu_opt_get(opts, "export"));
+ if (s->export && strlen(s->export) > NBD_MAX_STRING_SIZE) {
+ error_setg(errp, "export name too long to send to server");
+ goto error;
+ }
s->tlscredsid = g_strdup(qemu_opt_get(opts, "tls-creds"));
if (s->tlscredsid) {
@@ -1849,6 +1853,11 @@ static int nbd_process_options(BlockDriverState *bs, QDict *options,
}
s->x_dirty_bitmap = g_strdup(qemu_opt_get(opts, "x-dirty-bitmap"));
+ if (s->x_dirty_bitmap && strlen(s->x_dirty_bitmap) > NBD_MAX_STRING_SIZE) {
+ error_setg(errp, "x-dirty-bitmap query too long to send to server");
+ goto error;
+ }
+
s->reconnect_delay = qemu_opt_get_number(opts, "reconnect-delay", 0);
ret = 0;
@@ -1859,6 +1868,7 @@ static int nbd_process_options(BlockDriverState *bs, QDict *options,
qapi_free_SocketAddress(s->saddr);
g_free(s->export);
g_free(s->tlscredsid);
+ g_free(s->x_dirty_bitmap);
}
qemu_opts_del(opts);
return ret;