Skip to content

Commit def5028

Browse files
kresimir-cokobrianchandotcom
authored andcommitted
LPS-200583 - Check max files against modulePaths.length, and add error handling
1 parent 85d63e9 commit def5028

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

portal-impl/src/com/liferay/portal/servlet/ComboServlet.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ protected void doService(
307307
if (cacheEnabled && (modulePathsString != null) &&
308308
!PropsValues.COMBO_CHECK_TIMESTAMP) {
309309

310-
if (PropsValues.COMBO_MAX_FILES != -1) {
310+
if (modulePaths.length <= PropsValues.COMBO_MAX_FILES) {
311311
int totalFilesCount = 0;
312312

313313
List<String> keys = _bytesArrayPortalCache.getKeys();
@@ -323,6 +323,21 @@ protected void doService(
323323
}
324324
}
325325
}
326+
else {
327+
httpServletResponse.setHeader(
328+
HttpHeaders.CACHE_CONTROL,
329+
HttpHeaders.CACHE_CONTROL_NO_CACHE_VALUE);
330+
331+
httpServletResponse.setStatus(
332+
HttpServletResponse.SC_BAD_REQUEST);
333+
334+
if (_log.isWarnEnabled()) {
335+
_log.warn(
336+
"ComboServlet request exceeded maximum file count")
337+
}
338+
339+
return;
340+
}
326341

327342
_bytesArrayPortalCache.put(modulePathsString, bytesArray);
328343
}

0 commit comments

Comments
 (0)