Projects STRLCPY criu Commits 32c0983d
🤬
  • dump: increase fcntl call failure judgment The pipe_size type is unsigned int, when the fcntl call fails and return -1, it will cause a negative rollover problem.

    Signed-off-by: zhoujie <[email protected]>
  • Loading...
  • hdzhoujie committed with Andrei Vagin 1 year ago
    32c0983d
    1 parent cf21367d
  • ■ ■ ■ ■ ■
    criu/page-pipe.c
    skipped 98 lines
    99 99  {
    100 100   struct page_pipe_buf *prev = pp_prev_ppb(pp, ppb_flags);
    101 101   struct page_pipe_buf *ppb;
     102 + int ppb_size = 0;
    102 103   
    103 104   ppb = xmalloc(sizeof(*ppb));
    104 105   if (!ppb)
    skipped 15 lines
    120 121   cnt_add(CNT_PAGE_PIPES, 1);
    121 122   
    122 123   ppb->pipe_off = 0;
    123  - ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
     124 + ppb_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0);
     125 + if (ppb_size < 0) {
     126 + xfree(ppb);
     127 + pr_perror("Can't get pipe size");
     128 + return NULL;
     129 + }
     130 + ppb->pipe_size = ppb_size / PAGE_SIZE;
    124 131   pp->nr_pipes++;
    125 132   }
    126 133   
    skipped 330 lines
Please wait...
Page is in error, reload to recover