This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dhcpclient netlink bugs (was Re: [NETLINK]: Schedule removal of old macros exported to userspace)


Am Sonntag, 10. Dezember 2006 13:15 schrieb Thomas Graf:

> > Please send me the list of bugs you've spotted. Of course I want to fix
> > them.
>
> Sure...
>
> static void nl_handlemsg(struct nlmsghdr *msg, unsigned int len) {
>   if (len < sizeof(*msg)) return;
>
>   while(NLMSG_OK(msg,len)) {
>     if (nlcb_run &&
> 	nlcb_pid == msg->nlmsg_pid &&
> 	nlcb_seq == msg->nlmsg_seq) {
>       nlcb_function(msg, nlcb_args);
>
> Missing check for sufficient payload, family specific header
> and attributes are accessed directly, you've only made sure
> a netlink message header is present so far.

Yes, the code has quite some trust into the kernel that if it answers the 
asked question the answer is semantically correct. But to be fair, if you 
issue a write(), you also expect the number of bytes written in return and 
not the msec taken ;-) Will fix that and the other stuff you pointed out, 
thanks!

Stefan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]