Thread (10 messages) 10 messages, 6 authors, 2011-11-29

RE: [patch] isdn: make sure strings are null terminated

From: David Laight <hidden>
Date: 2011-11-24 12:31:55
Also in: kernel-janitors

 
quoted
quoted
quoted
+			if (strlen(dioctl.cf_ctrl.msn) >=
sizeof(dioctl.cf_ctrl.msn))
quoted
quoted
quoted
+				return -EINVAL;
...
So far i see you do not get a string, you get a structure. And 
it will hard to validate the element is a useful string.
I think my (sledgehammer) method is ok here because you
make sure that all later calls (strcmp,strcpy) will succeed.
If someone supplies a bad string the later calls will catch 
by failing to identify and return a proper code from there
(at least i hope so).

re,
 wh
Except that the strlen() can run right off the end
of the structure - and might eventually fault.
You need to use something like strnlen().

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help