mattiabertorello commented on issue #290: [LOG4J2-2650] Fix 
ArrayIndexOutOfBoundsException when the mac variable is an ipv6
URL: https://github.com/apache/logging-log4j2/pull/290#issuecomment-508564354
 
 
   Yes you are right, I was not sure what part of the code fix. 
   Because I didn't think that the `NetUtils.getMacAddress` method should 
return also an emulate MAC. In fact this line `mac = localHost.getAddress();`  
was pretty obscure to me why was there.
   In any case I replace it with these lines 
   
   ```
   
   // Emulate a mac address with an IP v4 or v6
   final byte[] address = localHost.getAddress();
   // Take only 6 bytes if the address is an IPv6 otherwise will pad with two 
zero bytes
   mac = Arrays.copyOf(address, 6);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to