Program: 178389
Project: 178389
Buggy source:
@Override public void write(Lineage2Connection conn,ChannelBuffer buffer){
  buffer.writeInt(characters.length);
  buffer.writeInt(0x07);
  buffer.writeByte(0x00);
  for (  final L2Character character : characters) {
    BufferUtils.writeString(buffer,character.getName());
    buffer.writeInt(character.getID().getID());
    BufferUtils.writeString(buffer,loginName);
    buffer.writeInt(sessionId);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x01);
    buffer.writeInt(character.getRace().id);
    buffer.writeInt(character.getCharacterClass().id);
    buffer.writeInt(0x01);
    buffer.writeInt(-71338);
    buffer.writeInt(258271);
    buffer.writeInt(-3104);
    buffer.writeDouble(20);
    buffer.writeDouble(20);
    buffer.writeInt(0x00);
    buffer.writeLong(ActorExperience.LEVEL_1.experience);
    buffer.writeInt(ActorExperience.LEVEL_1.level);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    for (int n=0; n < 7; n++) {
      buffer.writeInt(0x00);
    }
    writePaperdollItemID(buffer,character,HAIR1);
    writePaperdollItemID(buffer,character,RIGHT_EAR);
    writePaperdollItemID(buffer,character,LEFT_EAR);
    writePaperdollItemID(buffer,character,NECK);
    writePaperdollItemID(buffer,character,RIGHT_FINGER);
    writePaperdollItemID(buffer,character,LEFT_FINGER);
    writePaperdollItemID(buffer,character,HEAD);
    writePaperdollItemID(buffer,character,RIGHT_HAND);
    writePaperdollItemID(buffer,character,LEFT_HAND);
    writePaperdollItemID(buffer,character,GLOVES);
    writePaperdollItemID(buffer,character,CHEST);
    writePaperdollItemID(buffer,character,LEGS);
    writePaperdollItemID(buffer,character,FEET);
    writePaperdollItemID(buffer,character,CLOAK);
    writePaperdollItemID(buffer,character,RIGHT_HAND);
    writePaperdollItemID(buffer,character,HAIR1);
    writePaperdollItemID(buffer,character,HAIR2);
    writePaperdollItemID(buffer,character,RIGHT_BRACELET);
    writePaperdollItemID(buffer,character,LEFT_BRACELET);
    writePaperdollItemID(buffer,character,DECORATION_1);
    writePaperdollItemID(buffer,character,DECORATION_2);
    writePaperdollItemID(buffer,character,DECORATION_3);
    writePaperdollItemID(buffer,character,DECORATION_4);
    writePaperdollItemID(buffer,character,DECORATION_5);
    writePaperdollItemID(buffer,character,BELT);
    buffer.writeInt(0x02);
    buffer.writeInt(0x03);
    buffer.writeInt(0x00);
    buffer.writeDouble(30);
    buffer.writeDouble(30);
    buffer.writeInt(0x0);
    buffer.writeInt(character.getCharacterClass().id);
    buffer.writeInt(0x01);
    buffer.writeByte(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    if (conn.supports(FREYA)) {
      buffer.writeInt(16024);
      buffer.writeInt(0);
      buffer.writeInt(0);
      buffer.writeInt(0);
      buffer.writeDouble(0);
      buffer.writeDouble(0);
    }
  }
}

Fixed version (ground truth):
@Override public void write(Lineage2Connection conn,ChannelBuffer buffer){
  buffer.writeInt(characters.length);
  buffer.writeInt(7);
  buffer.writeByte(0x00);
  for (  final L2Character character : characters) {
    BufferUtils.writeString(buffer,character.getName());
    buffer.writeInt(character.getID().getID());
    BufferUtils.writeString(buffer,loginName);
    buffer.writeInt(sessionId);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(character.getSex().option);
    buffer.writeInt(character.getRace().id);
    buffer.writeInt(character.getCharacterClass().id);
    buffer.writeInt(1);
    buffer.writeInt(-71338);
    buffer.writeInt(258271);
    buffer.writeInt(-3104);
    buffer.writeDouble(20);
    buffer.writeDouble(20);
    buffer.writeInt(320);
    buffer.writeLong(4640);
    buffer.writeInt(5);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    for (int n=0; n < 7; n++) {
      buffer.writeInt(0x00);
    }
    writePaperdollItemID(buffer,character,HAIR1);
    writePaperdollItemID(buffer,character,RIGHT_EAR);
    writePaperdollItemID(buffer,character,LEFT_EAR);
    writePaperdollItemID(buffer,character,NECK);
    writePaperdollItemID(buffer,character,RIGHT_FINGER);
    writePaperdollItemID(buffer,character,LEFT_FINGER);
    writePaperdollItemID(buffer,character,HEAD);
    writePaperdollItemID(buffer,character,RIGHT_HAND);
    writePaperdollItemID(buffer,character,LEFT_HAND);
    writePaperdollItemID(buffer,character,GLOVES);
    writePaperdollItemID(buffer,character,CHEST);
    writePaperdollItemID(buffer,character,LEGS);
    writePaperdollItemID(buffer,character,FEET);
    writePaperdollItemID(buffer,character,CLOAK);
    writePaperdollItemID(buffer,character,RIGHT_HAND);
    writePaperdollItemID(buffer,character,HAIR1);
    writePaperdollItemID(buffer,character,HAIR2);
    writePaperdollItemID(buffer,character,RIGHT_BRACELET);
    writePaperdollItemID(buffer,character,LEFT_BRACELET);
    writePaperdollItemID(buffer,character,DECORATION_1);
    writePaperdollItemID(buffer,character,DECORATION_2);
    writePaperdollItemID(buffer,character,DECORATION_3);
    writePaperdollItemID(buffer,character,DECORATION_4);
    writePaperdollItemID(buffer,character,DECORATION_5);
    writePaperdollItemID(buffer,character,BELT);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    buffer.writeDouble(30);
    buffer.writeDouble(30);
    buffer.writeInt(0x0);
    buffer.writeInt(character.getCharacterClass().id);
    buffer.writeInt(1);
    buffer.writeByte(0x00);
    buffer.writeInt(0x00);
    buffer.writeInt(0x00);
    if (conn.supports(FREYA)) {
      buffer.writeInt(16024);
      buffer.writeInt(0);
      buffer.writeInt(0);
      buffer.writeInt(0);
      buffer.writeDouble(0);
      buffer.writeDouble(0);
    }
  }
}