mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1625. NPE with updateResourceCount when && is passed thru API.
If any API contains '&' i.e. no key value pair or '&<paramter-name>' i.e. a parameter without a value, then we get an NPE as owasp.esapi.StringUtilities.stripControls deosn't handle NPE.
This commit is contained in:
parent
c235d029ce
commit
da89946ca9
@ -327,10 +327,12 @@ public class ApiServer implements HttpRequestHandler, ApiServerService {
|
||||
}
|
||||
String[] value = (String[]) params.get(key);
|
||||
// fail if parameter value contains ASCII control (non-printable) characters
|
||||
String newValue = StringUtils.stripControlCharacters(value[0]);
|
||||
if ( !newValue.equals(value[0]) ) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Received value " + value[0] + " for parameter "
|
||||
+ key + " is invalid, contains illegal ASCII non-printable characters");
|
||||
if (value[0] != null) {
|
||||
String newValue = StringUtils.stripControlCharacters(value[0]);
|
||||
if ( !newValue.equals(value[0]) ) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Received value " + value[0] + " for parameter "
|
||||
+ key + " is invalid, contains illegal ASCII non-printable characters");
|
||||
}
|
||||
}
|
||||
paramMap.put(key, value[0]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user