]> granicus.if.org Git - sysstat/commitdiff
sar: Make sure that all the buffers are copied in copy_structures()
authorSebastien GODARD <sysstat@users.noreply.github.com>
Thu, 24 Feb 2022 08:51:38 +0000 (09:51 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Thu, 24 Feb 2022 08:51:38 +0000 (09:51 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa_common.c

index 1535e3a0a70d5c1c076fddeea8cfca9b858534ce..f4ec55540ba2f1c42d4d7b0bb87bee2ac8046a58 100644 (file)
@@ -1556,7 +1556,7 @@ void copy_structures(struct activity *act[], unsigned int id_seq[],
                p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND);
 
                memcpy(act[p]->buf[dest], act[p]->buf[src],
-                      (size_t) act[p]->msize * (size_t) act[p]->nr[src] * (size_t) act[p]->nr2);
+                      (size_t) act[p]->msize * (size_t) act[p]->nr_allocated * (size_t) act[p]->nr2);
                act[p]->nr[dest] = act[p]->nr[src];
        }
 }