diff --git a/extras/kernel/ebbchar/ebbchar.c b/extras/kernel/ebbchar/ebbchar.c index 771b859..b5fc0d2 100644 --- a/extras/kernel/ebbchar/ebbchar.c +++ b/extras/kernel/ebbchar/ebbchar.c @@ -142,7 +142,10 @@ static ssize_t dev_read(struct file *filep, char *buffer, size_t len, loff_t *of * @param offset The offset if required */ static ssize_t dev_write(struct file *filep, const char *buffer, size_t len, loff_t *offset){ - sprintf(message, "%s(%zu letters)", buffer, len); // appending received string with its length + if (copy_from_user(message, buffer, len)){ + printk(KERN_ALERT "EBBChar: kernel failed to copy message from user space\n"); + return -EFAULT; + } size_of_message = strlen(message); // store the length of the stored message printk(KERN_INFO "EBBChar: Received %zu characters from the user\n", len); return len;