Skip to content

Commit ac8161a

Browse files
committed
fix(DAV): Check if the header is actually the expected format
Not sure how the test ever passed as it can only throw with strict types which are not yet enabled Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 18637eb commit ac8161a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

apps/dav/lib/BulkUpload/MultipartRequestParser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ public function __construct(
5757
*/
5858
private function parseBoundaryFromHeaders(string $contentType): string {
5959
try {
60+
if (!str_contains($contentType, ';')) {
61+
throw new \InvalidArgumentException('No semicolon in header');
62+
}
6063
[$mimeType, $boundary] = explode(';', $contentType);
64+
if (!str_contains($boundary, '=')) {
65+
throw new \InvalidArgumentException('No equal in boundary header');
66+
}
6167
[$boundaryKey, $boundaryValue] = explode('=', $boundary);
6268
} catch (\Exception $e) {
6369
throw new BadRequest('Error while parsing boundary in Content-Type header.', Http::STATUS_BAD_REQUEST, $e);

0 commit comments

Comments
 (0)