]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
fix length check in proc_swaps_read
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 9 Feb 2016 21:58:29 +0000 (13:58 -0800)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 9 Feb 2016 21:59:17 +0000 (13:59 -0800)
thanks Nehal for reminding me.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
bindings.c

index 091bfb1e2fcd666c3fe67676dac4a6ac29faa652..c9f1f8f3d267aa45adedc3309260300890676ab8 100644 (file)
@@ -3593,7 +3593,7 @@ static int proc_swaps_read(char *buf, size_t size, off_t offset,
        }
 
        if (swap_total > 0) {
-               total_len += snprintf(d->buf + total_len, d->size,
+               total_len += snprintf(d->buf + total_len, d->size - total_len,
                                 "none%*svirtual\t\t%lu\t%lu\t0\n", 36, " ",
                                 swap_total, swap_free);
        }