On Fri, Apr 25, 2008 at 7:49 PM, Luis EG Ontanon <[EMAIL PROTECTED]> wrote:

> On Fri, Apr 25, 2008 at 10:17 PM, Jeff Morriss
> <[EMAIL PROTECTED]> wrote:
> >  Guy Harris wrote:
> >  >       
> > http://www.cs.berkeley.edu/~wychen/cs261/proposal.htm<http://www.cs.berkeley.edu/%7Ewychen/cs261/proposal.htm>
> >
> >  If Figure 1 is really a problem then my understanding of C just went out
> >  the window...
>
>
>
> I wouldn't have got this by myself without the explanation  but if you
> read the code as:
>
> typedef unsigned short uid_t;
>
> void dowork(uid_t u);
> int main() {
>    int x = read_from_network();
>    // Squish root (it's not safe to   execute dowork() with uid 0)
>    if ( (x & 0x0000ffff) == 0) exit(1);
>    //       ^^^^^^^^^^^^^
>    dowork(x);
> }
>
> you would have noticed the issue.
>

I get what he's saying but I just don't get it:  why would the compiler
convert from int to unsigned short *before* it has to send the value into
the call to dowork()?  E.g., 'x' should be an int until I (explicitly or
implicitly) cast it to something else, non?  Actually it should still be an
int after the call to dowork(); it just won't be an int when dowork() gets
it.

Maybe I need to go back to school because I'm feeling very noobish right
now.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@wireshark.org
http://www.wireshark.org/mailman/listinfo/wireshark-dev

Reply via email to