[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...)
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...) |
Date: |
Sat, 17 Jul 2010 15:36:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
Emilio Pozuelo Monfort <pochu27@gmail.com> 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.
Wouldn’t it be better to return EINVAL when *VALUE_LEN is not sane?
Thanks,
Ludo’.
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), (continued)
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Jérémie Koenig, 2010/07/15
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Emilio Pozuelo Monfort, 2010/07/15
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Emilio Pozuelo Monfort, 2010/07/15
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Emilio Pozuelo Monfort, 2010/07/15
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Carl Fredrik Hammar, 2010/07/15
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Emilio Pozuelo Monfort, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Samuel Thibault, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Carl Fredrik Hammar, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Carl Fredrik Hammar, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Emilio Pozuelo Monfort, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...),
Ludovic Courtès <=
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Carl Fredrik Hammar, 2010/07/17
- Re: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...), Ludovic Courtès, 2010/07/17
- RPC port classes (was: [PATCH] Implement getsockopt (fd, SOL_SOCKET, SO_TYPE, ...)), olafBuddenhagen, 2010/07/30