fixes the amount of allocated memory for ttypath, so that
there is place for '\0'

Signed-off-by: Yegor Yefremov <[email protected]>

Index: b/can-utils/slcand.c
===================================================================
--- a/can-utils/slcand.c        2011-01-05 10:13:25.000000000 +0100
+++ b/can-utils/slcand.c        2011-01-05 10:13:35.000000000 +0100
@@ -235,7 +235,7 @@
        if (pch == tty) {
                print_usage(argv[0]);
        }
-       ttypath = malloc((strlen(devprefix) + strlen(tty)) * sizeof(char));
+       ttypath = malloc((strlen(devprefix) + strlen(tty)) + sizeof(char));
        sprintf (ttypath, "%s%s", devprefix, tty);
        syslog (LOG_INFO, "starting on TTY device %s", ttypath);
 

_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to