• Andrew Vagin's avatar
    parasite: don't use a negative index to access array elements · 503350b9
    Andrew Vagin authored
    *** CID 158458:  Memory - corruptions  (NEGATIVE_RETURNS)
    /criu/pie/parasite.c: 321 in get_proc_fd()
    315
    316             ret = sys_readlinkat(AT_FDCWD, "/proc/self", buf, sizeof(buf));
    317             if (ret < 0 && ret != -ENOENT) {
    318                     pr_err("Can't readlink /proc/self (%d)\n", ret);
    319                     return ret;
    320             }
    >>>     CID 158458:  Memory - corruptions  (NEGATIVE_RETURNS)
    >>>     Using variable "ret" as an index to array "buf".
    321             buf[ret] = 0;
    322
    323             /* Fast path -- if /proc belongs to this pidns */
    324             if (pie_atoi(buf) == sys_getpid())
    325                     return sys_open("/proc", O_RDONLY, 0);
    326
    Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    503350b9
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
lib Loading commit data...
scripts Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Makefile Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...