]> rtime.felk.cvut.cz Git - can-utils.git/commitdiff
slcanpty: declare command buffer static
authorYegor Yefremov <yegorslists@googlemail.com>
Mon, 13 Jan 2014 13:29:16 +0000 (14:29 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 16 Jan 2014 15:31:50 +0000 (16:31 +0100)
ASCII command buffer char buf[200] must be declared as static,
because it holds incomplete commands between pty2can() calls.
Without static it is not guaranteed, that buf retains the same
data between calls.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
slcanpty.c

index 2c1cabea262f2b80f10a40bd9cf912a7c03a2a7b..c062a027da419bfaca0290e556aaa29019d4c85e 100644 (file)
@@ -68,7 +68,7 @@ int pty2can(int pty, int socket, struct can_filter *fi,
 {
        int nbytes;
        char cmd;
-       char buf[200];
+       static char buf[200];
        char replybuf[10]; /* for answers to received commands */
        int ptr;
        struct can_frame frame;