- fixed buffers size

This commit is contained in:
hamza 2025-05-21 14:10:38 +02:00
parent 8d67347001
commit ed8f1d31a7

View File

@ -33,7 +33,8 @@ static ssize_t universe_read(struct file *file, char __user *buf, size_t count,
}
len = strlen(answer);
sst_debug("About to copy %lu bytes of your answer at 0x%lx to the userspace\n", len, (uintptr_t)answer);
if (copy_to_user(buf, answer, len)) {
size_t toCopy = min(count, len);
if (copy_to_user(buf, answer, toCopy)) {
pr_err("User copy failed!\n");
kfree(answer);
return -EFAULT;