Program: 170985
Project: 170985
Buggy source:
/** 
 * Fill in the security fields of WifiConfiguration config.
 * @param config   The object to fill.
 * @param security If is OPEN, password is ignored.
 * @param password Password of the network if security is not OPEN.
 */
static void setupSecurity(@NonNull WifiConfiguration config,int security,@NonNull final String password){
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
switch (security) {
case SECURITY_NONE:
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  break;
case SECURITY_WEP:
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
if (ConnectorUtils.isHexWepKey(password)) config.wepKeys[0]=password;
 else config.wepKeys[0]=convertToQuotedString(password);
break;
case SECURITY_PSK:
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
if (password.matches("String_Node_Str")) config.preSharedKey=password;
 else config.preSharedKey=convertToQuotedString(password);
break;
case SECURITY_EAP:
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
config.preSharedKey=convertToQuotedString(password);
break;
default :
wifiLog("String_Node_Str" + security);
}
}

Fixed version (ground truth):
/** 
 * Fill in the security fields of WifiConfiguration config.
 * @param config   The object to fill.
 * @param security If is OPEN, password is ignored.
 * @param password Password of the network if security is not OPEN.
 */
static void setupSecurity(@NonNull WifiConfiguration config,String security,@NonNull final String password){
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
switch (security) {
case SECURITY_NONE:
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  break;
case SECURITY_WEP:
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
if (ConnectorUtils.isHexWepKey(password)) config.wepKeys[0]=password;
 else config.wepKeys[0]=convertToQuotedString(password);
break;
case SECURITY_WPA:
case SECURITY_WPA2:
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
config.allowedProtocols.set(SECURITY_WPA2.equals(security) ? WifiConfiguration.Protocol.RSN : WifiConfiguration.Protocol.WPA);
if (password.matches("String_Node_Str")) config.preSharedKey=password;
 else config.preSharedKey=convertToQuotedString(password);
break;
case SECURITY_WPA_EAP:
case SECURITY_IEEE8021X:
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
config.allowedKeyManagement.set(SECURITY_WPA_EAP.equals(security) ? WifiConfiguration.KeyMgmt.WPA_EAP : WifiConfiguration.KeyMgmt.IEEE8021X);
config.preSharedKey=convertToQuotedString(password);
break;
default :
wifiLog("String_Node_Str" + security);
}
}