From b044c7586b25fbda46f4097a1a567ab06de55cdc Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Wed, 6 Jul 2022 19:16:38 +0200 Subject: Check calendar URI length before creation Signed-off-by: Anna Larch --- apps/dav/lib/CalDAV/CalDavBackend.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apps') diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 42df838523d..a147d785cc7 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -64,6 +64,7 @@ use OCA\DAV\Events\CalendarUpdatedEvent; use OCA\DAV\Events\SubscriptionCreatedEvent; use OCA\DAV\Events\SubscriptionDeletedEvent; use OCA\DAV\Events\SubscriptionUpdatedEvent; +use OCP\Calendar\Exceptions\CalendarException; use OCP\DB\Exception; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; @@ -770,8 +771,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $calendarUri * @param array $properties * @return int + * + * @throws CalendarException */ public function createCalendar($principalUri, $calendarUri, array $properties) { + if (strlen($calendarUri) > 255) { + throw new CalendarException('URI too long. Calendar not created'); + } + $values = [ 'principaluri' => $this->convertPrincipal($principalUri, true), 'uri' => $calendarUri, -- cgit v1.2.3