Program: 30236
Project: 30236
Buggy source:
private GSSUPToken(ORB orb,Codec codec,byte[] authtok) throws SecurityMechanismException {
  byte[] name_utf8=null;
  byte[] password_utf8=null;
  byte[] target_name=null;
  String username="String_Node_Str";
  char[] userpwd=null;
  String realm="String_Node_Str";
  byte[] encoded_token=null;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
    _logger.log(Level.FINE,"String_Node_Str");
  }
  encoded_token=GSSUtils.getMechToken(GSSUtils.GSSUP_MECH_OID,authtok);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + encoded_token.length);
  }
  Any a=orb.create_any();
  try {
    a=codec.decode_value(encoded_token,InitialContextTokenHelper.type());
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  InitialContextToken inctxToken=InitialContextTokenHelper.extract(a);
  password_utf8=inctxToken.password;
  name_utf8=inctxToken.username;
  target_name=inctxToken.target_name;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + GSSUtils.dumpHex(name_utf8));
    _logger.fine("String_Node_Str" + "String_Node_Str");
    _logger.fine("String_Node_Str" + GSSUtils.dumpHex(target_name));
  }
  try {
    username=new String(name_utf8,"String_Node_Str");
    userpwd=Utility.convertByteArrayToCharArray(password_utf8,"String_Node_Str");
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  String name;
  int index=username.indexOf(DELIMITER);
  int esc_index=username.indexOf(ESCAPE_CHAR);
  if (index == -1) {
    name=username;
  }
 else   if (index == 0 || esc_index == 0) {
    throw new SecurityMechanismException("String_Node_Str");
  }
 else   if (esc_index != -1) {
    if (esc_index + 2 >= username.length()) {
      name=username.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
      }
      realm=DEFAULT_REALM_NAME;
    }
 else {
      int second_at_index=username.indexOf(DELIMITER,esc_index + 3);
      if (second_at_index == -1) {
        name=username.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
        }
        realm=DEFAULT_REALM_NAME;
      }
 else {
        name=username.substring(0,second_at_index);
        name=name.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
        realm=username.substring(second_at_index + 1);
        if (realm == null) {
          if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
          }
          realm=DEFAULT_REALM_NAME;
        }
      }
    }
  }
 else {
    StringTokenizer strtok=new StringTokenizer(username,DELIMITER);
    name=strtok.nextToken();
    if (strtok.hasMoreTokens()) {
      realm=strtok.nextToken();
      if (realm == null) {
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
        }
        realm=DEFAULT_REALM_NAME;
      }
    }
  }
  String targetNameRealm=null;
  try {
    if (target_name != null && target_name.length != 0) {
      targetNameRealm=new String(GSSUtils.importName(GSSUtils.GSSUP_MECH_OID,target_name));
    }
  }
 catch (  IOException ex) {
    _logger.log(Level.FINE,null,ex);
  }
  if (targetNameRealm != null && !DEFAULT_REALM_NAME.equals(targetNameRealm)) {
    realm=targetNameRealm;
  }
  pwdcred=new PasswordCredential(name,userpwd,realm,target_name);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,pwdcred.toString());
  }
}

Fixed version (ground truth):
private GSSUPToken(ORB orb,Codec codec,byte[] authtok) throws SecurityMechanismException {
  byte[] name_utf8=null;
  byte[] password_utf8=null;
  byte[] target_name=null;
  String username="String_Node_Str";
  char[] userpwd=null;
  String realm="String_Node_Str";
  byte[] encoded_token=null;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
    _logger.log(Level.FINE,"String_Node_Str");
  }
  encoded_token=GSSUtils.getMechToken(GSSUtils.GSSUP_MECH_OID,authtok);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + encoded_token.length);
  }
  Any a=orb.create_any();
  try {
    a=codec.decode_value(encoded_token,InitialContextTokenHelper.type());
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  InitialContextToken inctxToken=InitialContextTokenHelper.extract(a);
  password_utf8=inctxToken.password;
  name_utf8=inctxToken.username;
  target_name=inctxToken.target_name;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + GSSUtils.dumpHex(name_utf8));
    _logger.fine("String_Node_Str" + "String_Node_Str");
    _logger.fine("String_Node_Str" + GSSUtils.dumpHex(target_name));
  }
  try {
    username=new String(name_utf8,"String_Node_Str");
    userpwd=Utility.convertByteArrayToCharArray(password_utf8,"String_Node_Str");
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
  }
  String name;
  int index=username.indexOf(DELIMITER);
  int esc_index=username.indexOf(ESCAPE_CHAR);
  if (index == -1) {
    name=username;
  }
 else   if (index == 0 || esc_index == 0) {
    throw new SecurityMechanismException("String_Node_Str");
  }
 else   if (esc_index != -1) {
    if (esc_index + 2 >= username.length()) {
      name=username.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
      }
      realm=DEFAULT_REALM_NAME;
    }
 else {
      int second_at_index=username.indexOf(DELIMITER,esc_index + 3);
      if (second_at_index == -1) {
        name=username.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
        }
        realm=DEFAULT_REALM_NAME;
      }
 else {
        name=username.substring(0,second_at_index);
        name=name.replaceAll(ESCAPE_CHAR_REGEXP,DELIMITER);
        realm=username.substring(second_at_index + 1);
        if (realm == null || realm.isEmpty()) {
          if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
          }
          realm=DEFAULT_REALM_NAME;
        }
      }
    }
  }
 else {
    StringTokenizer strtok=new StringTokenizer(username,DELIMITER);
    name=strtok.nextToken();
    if (strtok.hasMoreTokens()) {
      realm=strtok.nextToken();
      if (realm.isEmpty()) {
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
        }
        realm=DEFAULT_REALM_NAME;
      }
    }
  }
  String targetNameRealm=null;
  try {
    if (target_name != null && target_name.length != 0) {
      targetNameRealm=new String(GSSUtils.importName(GSSUtils.GSSUP_MECH_OID,target_name));
    }
  }
 catch (  IOException ex) {
    _logger.log(Level.FINE,null,ex);
  }
  if (targetNameRealm != null && !DEFAULT_REALM_NAME.equals(targetNameRealm)) {
    realm=targetNameRealm;
  }
  pwdcred=new PasswordCredential(name,userpwd,realm,target_name);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,pwdcred.toString());
  }
}