diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-03-06 20:00:40 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-03-07 14:53:28 +0100 |
commit | daa0b0d4b17d25d7d46326bac8efa449300e3711 (patch) | |
tree | cf846304d14c2c0020fee08d6b230673476da766 /block/sheepdog.c | |
parent | 89e2a31d337f96ab8d5b7bdfe4bcce0a25181ed1 (diff) |
sheepdog: Don't truncate long VDI name in _open(), _create()
sd_parse_uri() truncates long VDI names silently. Reject them
instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index d3d373196c..fed7264cec 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -985,7 +985,10 @@ static int sd_parse_uri(BDRVSheepdogState *s, const char *filename, ret = -EINVAL; goto out; } - pstrcpy(vdi, SD_MAX_VDI_LEN, uri->path + 1); + if (g_strlcpy(vdi, uri->path + 1, SD_MAX_VDI_LEN) >= SD_MAX_VDI_LEN) { + ret = -EINVAL; + goto out; + } qp = query_params_parse(uri->query); if (qp->n > 1 || (s->is_unix && !qp->n) || (!s->is_unix && qp->n)) { |