diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-09-01 09:28:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 09:28:46 +0200 |
commit | 947328c75a6d5d5c048c6aa452c50e8d09e0a701 (patch) | |
tree | dc9bb5e17a64f03154a663532d8c1dc002f0ce67 | |
parent | e76bb271ec4ecd09f6ae2f1ba9a3f28523755830 (diff) | |
parent | ab113291d6fa95fdc1968b28257313ec749bfae2 (diff) | |
download | nextcloud-server-947328c75a6d5d5c048c6aa452c50e8d09e0a701.tar.gz nextcloud-server-947328c75a6d5d5c048c6aa452c50e8d09e0a701.zip |
Merge pull request #33782 from nextcloud/backport/33139/stable24
[stable24] Check calendar URI length before creation
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 7bd0768a2d3..5ce8a0562ce 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -63,6 +63,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; @@ -809,8 +810,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, diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 1c1754ff752..ebbf44376f5 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -416,6 +416,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @throws BadRequest */ public function createAddressBook($principalUri, $url, array $properties) { + if (strlen($url) > 255) { + throw new BadRequest('URI too long. Address book not created'); + } + $values = [ 'displayname' => null, 'description' => null, |