bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...)


From: Carl Fredrik Hammar
Subject: Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...)
Date: Sat, 17 Jul 2010 16:25:02 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Jul 17, 2010 at 03:36:43PM +0200, Ludovic Courtès wrote:
> Emilio Pozuelo Monfort <address@hidden> writes:
> 
> >  error_t
> >  S_socket_getopt (struct sock_user *user,
> >              int level, int opt,
> >              char **value, size_t *value_len)
> >  {
> > -  return EOPNOTSUPP;
> > +  int ret = 0;
> > +
> > +  if (!user)
> > +    return EOPNOTSUPP;
> > +
> > +  mutex_lock (&user->sock->lock);
> > +  switch (level)
> > +    {
> > +    case SOL_SOCKET:
> > +      switch (opt)
> > +   {
> > +   case SO_TYPE:
> > +     assert (*value_len >= sizeof (int));
> 
> IIUC, a client could pass *VALUE_LEN = 0 and cause the server to abort,
> because of the assertion here.

We have thought of this.

The value does not come from the client, it comes from MIG generated
code which gives you the (hard coded) length of a buffer inlined in the
reply message.  The client cannot affect this.

Regards,
  Fredrik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]