Code Monkey home page Code Monkey logo

imds-filterd's People

Contributors

cperciva avatar gperciva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imds-filterd's Issues

Left-shifting a negative value is undefined

imds-filterd/netconfig.c, line 88:

                /* Which address type is this? */
                if ((i = ffs(rt->rtm_addrs & ((-1) << i))) == 0) {
                        warn0("Routing message contains wrong number of addresses!");
                        goto err0;
                }

I believe that (-1) << i is undefined in C99. The spec says:

C99 draft, 6.5.7 Bitwise shift operators
..
4. The result of E1 << E2 is E1 left-shifted E2 bit positions... If E1 has a signed
type and nonnegative value, and E1 × 2^{E2} is representable in the result type, then that is
the resulting value; otherwise, the behavior is undefined.

One fix might be to change (-1) to ((size_t)-1), but I see that struct rt_msghrd contains int rtmaddrs. So maybe the whole line should be

                if ((i = ffs(rt->rtm_addrs & (int)(((size_t)-1) << i))) == 0) {

But I've never worked with man 4 route before, nor do I have a good sense of what that code is doing, so I figured that I'd leave it to you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.