PERFORCE change 136936 for review
Roman Divacky
rdivacky at FreeBSD.org
Wed Mar 5 18:16:46 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136936
Change 136936 by rdivacky at rdivacky_witten on 2008/03/05 18:16:33
Check for sane maxevents parameter.
Noticed by: netchild
Affected files ...
.. //depot/projects/soc2007/rdivacky/linux_epoll/sys/compat/linux/linux_epoll.c#11 edit
.. //depot/projects/soc2007/rdivacky/linux_epoll/sys/compat/linux/linux_epoll.h#5 edit
Differences ...
==== //depot/projects/soc2007/rdivacky/linux_epoll/sys/compat/linux/linux_epoll.c#11 (text+ko) ====
@@ -29,6 +29,7 @@
#include "opt_compat.h"
+#include <sys/limits.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -228,6 +229,9 @@
linux_kev_copyin};
int error;
+ if (args->maxevents <= 0 || args->maxevents > LINUX_MAX_EVENTS)
+ return (EINVAL);
+
/* Convert from miliseconds to timespec. */
ts.tv_sec = args->timeout / 1000000;
ts.tv_nsec = (args->timeout % 1000000) * 1000;
==== //depot/projects/soc2007/rdivacky/linux_epoll/sys/compat/linux/linux_epoll.h#5 (text+ko) ====
@@ -50,4 +50,6 @@
#define LINUX_EPOLL_CTL_DEL 2
#define LINUX_EPOLL_CTL_MOD 3
+#define LINUX_MAX_EVENTS (INT_MAX / sizeof(struct linux_epoll_event))
+
#endif /* !_LINUX_EPOLL_H_ */
More information about the p4-projects
mailing list