Program: 180835
Project: 180835
Buggy source:
WifiConfiguration getConfig(){
  if (mAccessPoint != null && mAccessPoint.networkId != -1 && !edit) {
    return null;
  }
  WifiConfiguration config=new WifiConfiguration();
  if (mAccessPoint == null) {
    config.SSID=mSsid.getText().toString();
    config.hiddenSSID=true;
  }
 else   if (mAccessPoint.networkId == -1) {
    config.SSID=mAccessPoint.ssid;
  }
 else {
    config.networkId=mAccessPoint.networkId;
  }
switch (mSecurity) {
case AccessPoint.SECURITY_NONE:
    config.allowedKeyManagement.set(KeyMgmt.NONE);
  return config;
case AccessPoint.SECURITY_WEP:
config.allowedKeyManagement.set(KeyMgmt.NONE);
config.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN);
config.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED);
if (mPassword.length() != 0) {
int length=mPassword.length();
String password=mPassword.getText().toString();
if ((length == 10 || length == 26 || length == 58) && password.matches("String_Node_Str")) {
config.wepKeys[0]=password;
}
 else {
config.wepKeys[0]='"' + password + '"';
}
}
return config;
case AccessPoint.SECURITY_PSK:
config.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
if (mPassword.length() != 0) {
String password=mPassword.getText().toString();
if (password.matches("String_Node_Str")) {
config.preSharedKey=password;
}
 else {
config.preSharedKey='"' + password + '"';
}
}
return config;
case AccessPoint.SECURITY_EAP:
config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
config.eap.setValue((String)mEapMethod.getSelectedItem());
config.ca_cert.setValue((mEapCaCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.CA_CERTIFICATE + (String)mEapCaCert.getSelectedItem());
config.client_cert.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE + (String)mEapUserCert.getSelectedItem());
config.private_key.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.USER_PRIVATE_KEY + (String)mEapUserCert.getSelectedItem());
config.identity.setValue((mEapIdentity.length() == 0) ? "String_Node_Str" : mEapIdentity.getText().toString());
config.anonymous_identity.setValue((mEapAnonymous.length() == 0) ? "String_Node_Str" : mEapAnonymous.getText().toString());
if (mPassword.length() != 0) {
config.password.setValue(mPassword.getText().toString());
}
return config;
}
return null;
}

Fixed version (ground truth):
WifiConfiguration getConfig(){
  if (mAccessPoint != null && mAccessPoint.networkId != -1 && !edit) {
    return null;
  }
  WifiConfiguration config=new WifiConfiguration();
  if (mAccessPoint == null) {
    config.SSID=AccessPoint.convertToQuotedString(mSsid.getText().toString());
    config.hiddenSSID=true;
  }
 else   if (mAccessPoint.networkId == -1) {
    config.SSID=AccessPoint.convertToQuotedString(mAccessPoint.ssid);
  }
 else {
    config.networkId=mAccessPoint.networkId;
  }
switch (mSecurity) {
case AccessPoint.SECURITY_NONE:
    config.allowedKeyManagement.set(KeyMgmt.NONE);
  return config;
case AccessPoint.SECURITY_WEP:
config.allowedKeyManagement.set(KeyMgmt.NONE);
config.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN);
config.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED);
if (mPassword.length() != 0) {
int length=mPassword.length();
String password=mPassword.getText().toString();
if ((length == 10 || length == 26 || length == 58) && password.matches("String_Node_Str")) {
config.wepKeys[0]=password;
}
 else {
config.wepKeys[0]='"' + password + '"';
}
}
return config;
case AccessPoint.SECURITY_PSK:
config.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
if (mPassword.length() != 0) {
String password=mPassword.getText().toString();
if (password.matches("String_Node_Str")) {
config.preSharedKey=password;
}
 else {
config.preSharedKey='"' + password + '"';
}
}
return config;
case AccessPoint.SECURITY_EAP:
config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
config.eap.setValue((String)mEapMethod.getSelectedItem());
config.ca_cert.setValue((mEapCaCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.CA_CERTIFICATE + (String)mEapCaCert.getSelectedItem());
config.client_cert.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE + (String)mEapUserCert.getSelectedItem());
config.private_key.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "String_Node_Str" : KEYSTORE_SPACE + Credentials.USER_PRIVATE_KEY + (String)mEapUserCert.getSelectedItem());
config.identity.setValue((mEapIdentity.length() == 0) ? "String_Node_Str" : mEapIdentity.getText().toString());
config.anonymous_identity.setValue((mEapAnonymous.length() == 0) ? "String_Node_Str" : mEapAnonymous.getText().toString());
if (mPassword.length() != 0) {
config.password.setValue(mPassword.getText().toString());
}
return config;
}
return null;
}