Thread (7 messages) 7 messages, 4 authors, 2012-07-30

Re: [PATCH] net/tun: fix ioctl() based info leaks

From: Mathias Krause <hidden>
Date: 2012-07-30 05:38:38

On Mon, Jul 30, 2012 at 1:11 AM, richard -rw- weinberger
[off-list ref] wrote:
On Sun, Jul 29, 2012 at 10:58 PM, Mathias Krause [off-list ref] wrote:
quoted
-       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
+       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) {
                if (copy_from_user(&ifr, argp, ifreq_len))
                        return -EFAULT;
+       } else {
+               memset(&ifr, 0, sizeof(ifr));
+       }

        if (cmd == TUNGETFEATURES) {
                /* Currently this just means: "what IFF flags are valid?".
The fix makes sense to me.

Beside of the fix, why are you adding braces to if and else?
The pair of braces around the "if" is needed to attach the "else"
branch to the right "if". The braces around the "else" are just for
consistency.
We don't use braces on single statements.
Even tun.c isn't consistently following this rule but I'll send a new
patch without the "else" braces.


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