patch-2.4.5 linux/drivers/net/wan/comx.c
Next file: linux/drivers/net/wan/cycx_main.c
Previous file: linux/drivers/net/wan/comx-hw-comx.c
Back to the patch index
Back to the overall index
- Lines: 32
- Date:
Tue May 22 10:23:16 2001
- Orig file:
v2.4.4/linux/drivers/net/wan/comx.c
- Orig date:
Tue Mar 6 19:44:36 2001
diff -u --recursive --new-file v2.4.4/linux/drivers/net/wan/comx.c linux/drivers/net/wan/comx.c
@@ -621,9 +621,20 @@
if (!(page = (char *)__get_free_page(GFP_KERNEL))) return -ENOMEM;
- copy_from_user(page, buffer, count);
+ if(copy_from_user(page, buffer, count))
+ {
+ count = -EFAULT;
+ goto out;
+ }
- if (*(page + count - 1) == '\n') *(page + count - 1) = 0;
+ if (page[count-1] == '\n')
+ page[count-1] = '\0';
+ else if (count < PAGE_SIZE)
+ page[count] = '\0';
+ else if (page[count]) {
+ count = -EINVAL;
+ goto out;
+ }
if (strcmp(entry->name, FILENAME_DEBUG) == 0) {
int i;
@@ -764,7 +775,7 @@
}
}
}
-
+out:
free_page((unsigned long)page);
return count;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)