cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wilderrodrigues <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Cwe 190
Date Wed, 11 Nov 2015 09:38:46 GMT
Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1057#discussion_r44515580
  
    --- Diff: utils/src/main/java/com/cloud/utils/net/NetUtils.java ---
    @@ -775,11 +776,19 @@ public static String getSubNet(final String ip, final String netmask)
{
         }
     
         public static String getCidrSubNet(final String ip, final long cidrSize) {
    -        final long numericNetmask = 0xffffffff >> MAX_CIDR - cidrSize <<
MAX_CIDR - cidrSize;
    +        final long numericNetmask = netMaskFromCidr(cidrSize);
             final String netmask = NetUtils.long2Ip(numericNetmask);
             return getSubNet(ip, netmask);
         }
     
    +    /**
    +     * @param cidrSize
    +     * @return
    +     */
    +    static long netMaskFromCidr(final long cidrSize) {
    +        return ((long)0xffffffff) >> MAX_CIDR - cidrSize << MAX_CIDR - cidrSize;
    +    }
    +
    --- End diff --
    
    Why are tho static methods using "package" modifier? Are classes in the same package going
to access it? If the answer is no, they can be made "private".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message