]> granicus.if.org Git - strace/blobdiff - util.c
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
[strace] / util.c
diff --git a/util.c b/util.c
index d92c0ea83821749f0f4af177121a26a7e36d2dc3..e477cf10e9ac0f52f894e866b20867d9f6a7aadc 100644 (file)
--- a/util.c
+++ b/util.c
@@ -532,15 +532,15 @@ long addr;
 {
        struct iovec *iov;
        int i;
+       unsigned long size;
 
-
-       if ((iov = (struct iovec *) malloc(len * sizeof *iov)) == NULL) {
-               fprintf(stderr, "dump: No memory");
+       size = sizeof(*iov) * (unsigned long) len;
+       if (size / sizeof(*iov) != len
+           || (iov = (struct iovec *) malloc(size)) == NULL) {
+               fprintf(stderr, "out of memory\n");
                return;
        }
-       if (umoven(tcp, addr,
-                  len * sizeof *iov, (char *) iov) >= 0) {
-
+       if (umoven(tcp, addr, size, (char *) iov) >= 0) {
                for (i = 0; i < len; i++) {
                         /* include the buffer number to make it easy to
                          * match up the trace with the source */