2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-03 15:55:53 +00:00

bfd: avoid out-of-bound access

Write a nullbyte only if there is enought space for it.

Cc: Stephen Röttger <stephen.roettger@gmail.com>
Reported-by: Stephen Röttger <stephen.roettger@gmail.com>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
This commit is contained in:
Andrei Vagin
2018-01-25 16:46:59 -08:00
committed by Andrei Vagin
parent 0d9d271203
commit ecbec8be07

View File

@@ -196,6 +196,11 @@ again:
if (!b->sz) if (!b->sz)
return NULL; return NULL;
if (b->sz == BUFSIZE) {
pr_err("The bfd buffer is too small\n");
ERR_PTR(-EIO);
return NULL;
}
/* /*
* Last bytes may lack the \n at the * Last bytes may lack the \n at the
* end, need to report this as full * end, need to report this as full