]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/caif/caif_serial.c
caif: add a sanity check to the tty name
[karo-tx-linux.git] / drivers / net / caif / caif_serial.c
index 34dea95d58dbf3fd06e0a83e4965b77e63bd3946..88a6a5810ec6820a1e8f2b674021a4a142804885 100644 (file)
@@ -347,7 +347,9 @@ static int ldisc_open(struct tty_struct *tty)
        /* release devices to avoid name collision */
        ser_release(NULL);
 
-       sprintf(name, "cf%s", tty->name);
+       result = snprintf(name, sizeof(name), "cf%s", tty->name);
+       if (result >= IFNAMSIZ)
+               return -EINVAL;
        dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
        if (!dev)
                return -ENOMEM;