Program: 64300
Project: 64300
Buggy source:
/** 
 * Get the next entry in this tar archive. This will skip over any remaining data in the current entry, if there is one, and place the input stream at the header of the next entry, and read the header and instantiate a new TarEntry from the header bytes and return that entry. If there are no more entries in the archive, null will be returned to indicate that the end of the archive has been reached.
 * @return The next TarEntry in the archive, or null.
 * @exception IOException Description of Exception
 */
public TarEntry getNextEntry() throws IOException {
  if (m_hasHitEOF) {
    return null;
  }
  if (m_currEntry != null) {
    final int numToSkip=m_entrySize - m_entryOffset;
    if (m_debug) {
      final String message="String_Node_Str" + m_currEntry.getName() + "String_Node_Str"+ m_entrySize+ "String_Node_Str"+ m_entryOffset+ "String_Node_Str"+ numToSkip+ "String_Node_Str";
      debug(message);
    }
    if (numToSkip > 0) {
      skip(numToSkip);
    }
    m_readBuf=null;
  }
  final byte[] headerBuf=m_buffer.readRecord();
  if (headerBuf == null) {
    if (m_debug) {
      debug("String_Node_Str");
    }
    m_hasHitEOF=true;
  }
 else   if (m_buffer.isEOFRecord(headerBuf)) {
    if (m_debug) {
      debug("String_Node_Str");
    }
    m_hasHitEOF=true;
  }
  if (m_hasHitEOF) {
    m_currEntry=null;
  }
 else {
    m_currEntry=new TarEntry(headerBuf);
    if (!(headerBuf[257] == 'u' && headerBuf[258] == 's' && headerBuf[259] == 't' && headerBuf[260] == 'a' && headerBuf[261] == 'r')) {
      m_v7Format=true;
    }
    if (m_debug) {
      final String message="String_Node_Str" + m_currEntry.getName() + "String_Node_Str"+ m_currEntry.getSize();
      debug(message);
    }
    m_entryOffset=0;
    m_entrySize=(int)m_currEntry.getSize();
  }
  if (null != m_currEntry && m_currEntry.isGNULongNameEntry()) {
    final StringBuffer longName=new StringBuffer();
    final byte[] buffer=new byte[256];
    int length=0;
    while ((length=read(buffer)) >= 0) {
      final String str=new String(buffer,0,length);
      longName.append(str);
    }
    getNextEntry();
    m_currEntry.setName(longName.toString());
  }
  return m_currEntry;
}

Fixed version (ground truth):
/** 
 * Get the next entry in this tar archive. This will skip over any remaining data in the current entry, if there is one, and place the input stream at the header of the next entry, and read the header and instantiate a new TarEntry from the header bytes and return that entry. If there are no more entries in the archive, null will be returned to indicate that the end of the archive has been reached.
 * @return The next TarEntry in the archive, or null.
 * @exception IOException Description of Exception
 */
public TarEntry getNextEntry() throws IOException {
  if (m_hasHitEOF) {
    return null;
  }
  if (m_currEntry != null) {
    final int numToSkip=m_entrySize - m_entryOffset;
    if (m_debug) {
      final String message="String_Node_Str" + m_currEntry.getName() + "String_Node_Str"+ m_entrySize+ "String_Node_Str"+ m_entryOffset+ "String_Node_Str"+ numToSkip+ "String_Node_Str";
      debug(message);
    }
    if (numToSkip > 0) {
      skip(numToSkip);
    }
    m_readBuf=null;
  }
  final byte[] headerBuf=m_buffer.readRecord();
  if (headerBuf == null) {
    if (m_debug) {
      debug("String_Node_Str");
    }
    m_hasHitEOF=true;
  }
 else   if (m_buffer.isEOFRecord(headerBuf)) {
    if (m_debug) {
      debug("String_Node_Str");
    }
    m_hasHitEOF=true;
  }
  if (m_hasHitEOF) {
    m_currEntry=null;
  }
 else {
    m_currEntry=new TarEntry(headerBuf);
    if (!(headerBuf[257] == 'u' && headerBuf[258] == 's' && headerBuf[259] == 't' && headerBuf[260] == 'a' && headerBuf[261] == 'r')) {
    }
    if (m_debug) {
      final String message="String_Node_Str" + m_currEntry.getName() + "String_Node_Str"+ m_currEntry.getSize();
      debug(message);
    }
    m_entryOffset=0;
    m_entrySize=(int)m_currEntry.getSize();
  }
  if (null != m_currEntry && m_currEntry.isGNULongNameEntry()) {
    final StringBuffer longName=new StringBuffer();
    final byte[] buffer=new byte[256];
    int length=0;
    while ((length=read(buffer)) >= 0) {
      final String str=new String(buffer,0,length);
      longName.append(str);
    }
    getNextEntry();
    m_currEntry.setName(longName.toString());
  }
  return m_currEntry;
}