aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorG. Campana <gcampana+kvm@quarkslab.com>2016-11-21 11:48:08 +0100
committerWill Deacon <will.deacon@arm.com>2016-11-28 11:15:34 +0000
commit716b2944e2eb92b4b43ec35c4347b5f9b853e6eb (patch)
tree0c0f3857d81999c29c937ef996bf226ffbc33cec
parentd4727f2bbefff9c6869c8f5dfb28d1aeda032ee9 (diff)
downloadkvmtool-716b2944e2eb92b4b43ec35c4347b5f9b853e6eb.tar.gz
kvmtool: 9p: fix check for snprintf truncation of full_path
The check on the return value of snprintf should reuse the size parameter, rather than take sizeof(full_path) as the bound. Signed-off-by: G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--virtio/9p.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virtio/9p.c b/virtio/9p.c
index 337bf75f..7185bb73 100644
--- a/virtio/9p.c
+++ b/virtio/9p.c
@@ -250,7 +250,7 @@ static int get_full_path_helper(char *full_path, size_t size,
int ret;
ret = snprintf(full_path, size, "%s/%s", dirname, name);
- if (ret >= (int)sizeof(full_path)) {
+ if (ret >= (int)size) {
errno = ENAMETOOLONG;
return -1;
}