OSDN Git Service

modetest: Fix segmentation fault
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 22 Jul 2019 16:08:22 +0000 (13:08 -0300)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 21 Jan 2020 17:56:23 +0000 (17:56 +0000)
When a mode is set with just a connector "-s foo",
we get a nasty segmentation fault. Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
tests/modetest/modetest.c

index 2443697..09fd565 100644 (file)
@@ -1721,6 +1721,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
                return -1;
 
        /* Parse the remaining parameters. */
+       if (!endp)
+               return -1;
        if (*endp == '@') {
                arg = endp + 1;
                pipe->crtc_id = strtoul(arg, &endp, 10);