Program: 86664
Project: 86664
Buggy source:
/** 
 * Build a list of commands matching the given string.
 * @param caller
 * @param command
 * @return nullchar separated stringbuilder
 */
public StringBuilder matchCommand(MessageReceiver caller,String command,boolean onlySubcommands){
  int matches=0;
  int maxMatches=4;
  StringBuilder matching=new StringBuilder();
  command=command.toLowerCase();
  for (  String key : commands.keySet()) {
    if (!onlySubcommands) {
      if (key.toLowerCase().equals(command)) {
        if (matching.indexOf("String_Node_Str".concat(key)) == -1) {
          if (commands.get(key).canUse(caller) && matches <= maxMatches) {
            ++matches;
            matching.append("String_Node_Str").append(key).append("String_Node_Str");
          }
        }
      }
 else       if (key.toLowerCase().indexOf(command) != -1) {
        if (matching.indexOf("String_Node_Str".concat(key)) == -1) {
          if (commands.get(key).canUse(caller) && matches <= maxMatches) {
            ++matches;
            matching.append("String_Node_Str").append(key).append("String_Node_Str");
          }
        }
      }
    }
    for (    CanaryCommand cmd : commands.get(key).getSubCommands(new ArrayList<CanaryCommand>())) {
      for (      String alias : cmd.meta.aliases()) {
        if (alias.toLowerCase().equals(command)) {
          if (matching.indexOf(alias) == -1) {
            if (cmd.canUse(caller) && matches <= maxMatches) {
              ++matches;
              matching.append(alias).append("String_Node_Str");
            }
          }
        }
 else         if (alias.toLowerCase().indexOf(command) != -1) {
          if (matching.indexOf(alias) == -1) {
            if (cmd.canUse(caller) && matches <= maxMatches) {
              ++matches;
              matching.append(alias).append("String_Node_Str");
            }
          }
        }
      }
    }
  }
  return matching;
}

Fixed version (ground truth):
/** 
 * Build a list of commands matching the given string.
 * @param caller
 * @param command
 * @return nullchar separated stringbuilder
 */
public StringBuilder matchCommand(MessageReceiver caller,String command,boolean onlySubcommands){
  int matches=0;
  int maxMatches=4;
  StringBuilder matching=new StringBuilder();
  command=command.toLowerCase();
  for (  String key : commands.keySet()) {
    if (!onlySubcommands) {
      if (key.toLowerCase().equals(command)) {
        if (matching.indexOf("String_Node_Str".concat(key)) == -1) {
          if (commands.get(key).canUse(caller) && matches <= maxMatches) {
            ++matches;
            matching.append("String_Node_Str").append(key).append("String_Node_Str");
          }
        }
      }
 else       if (key.toLowerCase().contains(command)) {
        if (matching.indexOf("String_Node_Str".concat(key)) == -1) {
          if (commands.get(key).canUse(caller) && matches <= maxMatches) {
            ++matches;
            matching.append("String_Node_Str").append(key).append("String_Node_Str");
          }
        }
      }
    }
    for (    CanaryCommand cmd : commands.get(key).getSubCommands(new ArrayList<CanaryCommand>())) {
      for (      String alias : cmd.meta.aliases()) {
        if (alias.toLowerCase().equals(command)) {
          if (matching.indexOf(alias) == -1) {
            if (cmd.canUse(caller) && matches <= maxMatches) {
              ++matches;
              matching.append(alias).append("String_Node_Str");
            }
          }
        }
 else         if (alias.toLowerCase().contains(command)) {
          if (matching.indexOf(alias) == -1) {
            if (cmd.canUse(caller) && matches <= maxMatches) {
              ++matches;
              matching.append(alias).append("String_Node_Str");
            }
          }
        }
      }
    }
  }
  return matching;
}