mw_debug: Fix memory overflow with "sim" backend
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 28 May 2020 14:04:46 +0000 (00:04 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 2 Jun 2020 09:56:08 +0000 (19:56 +1000)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
scripts/mw_debug/mw_debug.c

index fec9722e58bff9198c4ffc68f25c3249d56fe0b3..8999c8c706a41c4a93f1e430ff585fd04902e204 100644 (file)
@@ -176,7 +176,7 @@ static int sim_command(uint8_t op, uint8_t addr, uint64_t *data)
                printf("\n");
        }
        write(sim_fd, buf, p - buf);
-       r = read(sim_fd, buf, 127);
+       r = read(sim_fd, buf, sizeof(buf));
        if (0 && r > 0) {
                int i;