[CRIU] Off by one in mnt_get_sibling_path()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Sep 20 07:17:27 PDT 2016


Hi,

int off = 0;

...

if (p->mountpoint[1] != 0) /* not "/" */
	off = snprintf(path, len, "%s", p->mountpoint);
if (path[off - 1] == '/') /* p->mountpoint = "./" */

         ^^^
The above looks like off-by-one when off == 0. Is there is
a condition which guarantees that off is not zero?

Regards,
Kirill


More information about the CRIU mailing list