Program: 4418
Project: 4418
Buggy source:
/** 
 * Creates a new <tt>PingReply</tt> instance from the network.
 * @param guid the Globally Unique Identifier (GUID) for this message
 * @param ttl the time to live for this message
 * @param hops the hops for this message
 * @param payload the message payload
 * @throws <tt>BadPacketException</tt> if the message is invalid forany reason
 */
public static PingReply createFromNetwork(byte[] guid,byte ttl,byte hops,byte[] payload) throws BadPacketException {
  if (guid == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (payload == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (payload.length < STANDARD_PAYLOAD_SIZE) {
    ReceivedErrorStat.PING_REPLY_INVALID_PAYLOAD.incrementStat();
    throw new BadPacketException("String_Node_Str");
  }
  int port=ByteOrder.ubytes2int(ByteOrder.leb2short(payload,0));
  if (!NetworkUtils.isValidPort(port)) {
    ReceivedErrorStat.PING_REPLY_INVALID_PORT.incrementStat();
    throw new BadPacketException("String_Node_Str" + port);
  }
  String ipString=NetworkUtils.ip2string(payload,2);
  if (!NetworkUtils.isValidAddress(ipString)) {
    ReceivedErrorStat.PING_REPLY_INVALID_ADDRESS.incrementStat();
    throw new BadPacketException("String_Node_Str" + ipString);
  }
  InetAddress ip;
  try {
    ip=InetAddress.getByName(NetworkUtils.ip2string(payload,2));
  }
 catch (  UnknownHostException e) {
    throw new BadPacketException("String_Node_Str" + ipString + "String_Node_Str"+ e.getMessage());
  }
  GGEP ggep=parseGGEP(payload);
  if (ggep != null && ggep.hasKey(GGEP.GGEP_HEADER_VENDOR_INFO)) {
    byte[] vendorBytes=null;
    try {
      vendorBytes=ggep.getBytes(GGEP.GGEP_HEADER_VENDOR_INFO);
    }
 catch (    BadGGEPPropertyException e) {
      ReceivedErrorStat.PING_REPLY_INVALID_GGEP.incrementStat();
      throw new BadPacketException("String_Node_Str" + vendorBytes);
    }
    if (vendorBytes.length < 4) {
      ReceivedErrorStat.PING_REPLY_INVALID_VENDOR.incrementStat();
      throw new BadPacketException("String_Node_Str" + vendorBytes.length);
    }
    if (ggep.hasKey(GGEP.GGEP_HEADER_CLIENT_LOCALE)) {
      try {
        byte[] clocale=ggep.getBytes(GGEP.GGEP_HEADER_CLIENT_LOCALE);
      }
 catch (      BadGGEPPropertyException e) {
        ReceivedErrorStat.PING_REPLY_INVALID_GGEP.incrementStat();
        throw new BadPacketException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
  return new PingReply(guid,ttl,hops,payload,ggep,ip);
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>PingReply</tt> instance from the network.
 * @param guid the Globally Unique Identifier (GUID) for this message
 * @param ttl the time to live for this message
 * @param hops the hops for this message
 * @param payload the message payload
 * @throws <tt>BadPacketException</tt> if the message is invalid forany reason
 */
public static PingReply createFromNetwork(byte[] guid,byte ttl,byte hops,byte[] payload) throws BadPacketException {
  if (guid == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (payload == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (payload.length < STANDARD_PAYLOAD_SIZE) {
    ReceivedErrorStat.PING_REPLY_INVALID_PAYLOAD.incrementStat();
    throw new BadPacketException("String_Node_Str");
  }
  int port=ByteOrder.ubytes2int(ByteOrder.leb2short(payload,0));
  if (!NetworkUtils.isValidPort(port)) {
    ReceivedErrorStat.PING_REPLY_INVALID_PORT.incrementStat();
    throw new BadPacketException("String_Node_Str" + port);
  }
  String ipString=NetworkUtils.ip2string(payload,2);
  if (!NetworkUtils.isValidAddress(ipString)) {
    ReceivedErrorStat.PING_REPLY_INVALID_ADDRESS.incrementStat();
    throw new BadPacketException("String_Node_Str" + ipString);
  }
  InetAddress ip;
  try {
    ip=InetAddress.getByName(NetworkUtils.ip2string(payload,2));
  }
 catch (  UnknownHostException e) {
    throw new BadPacketException("String_Node_Str" + ipString + "String_Node_Str"+ e.getMessage());
  }
  GGEP ggep=parseGGEP(payload);
  if (ggep != null) {
    if (ggep.hasKey(GGEP.GGEP_HEADER_VENDOR_INFO)) {
      byte[] vendorBytes=null;
      try {
        vendorBytes=ggep.getBytes(GGEP.GGEP_HEADER_VENDOR_INFO);
      }
 catch (      BadGGEPPropertyException e) {
        ReceivedErrorStat.PING_REPLY_INVALID_GGEP.incrementStat();
        throw new BadPacketException("String_Node_Str" + vendorBytes);
      }
      if (vendorBytes.length < 4) {
        ReceivedErrorStat.PING_REPLY_INVALID_VENDOR.incrementStat();
        throw new BadPacketException("String_Node_Str" + vendorBytes.length);
      }
    }
    if (ggep.hasKey(GGEP.GGEP_HEADER_CLIENT_LOCALE)) {
      try {
        byte[] clocale=ggep.getBytes(GGEP.GGEP_HEADER_CLIENT_LOCALE);
      }
 catch (      BadGGEPPropertyException e) {
        ReceivedErrorStat.PING_REPLY_INVALID_GGEP.incrementStat();
        throw new BadPacketException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
  return new PingReply(guid,ttl,hops,payload,ggep,ip);
}