diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-08-26 16:35:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-26 16:35:17 +0200 |
commit | fa466a093cef75abaf0696421f4a9b640122242c (patch) | |
tree | 776c972a8299e6996fe91b3b326a15702ebf8c40 | |
parent | aa150b9f85a2543fdbac8e73b5e6f8bb39f125f4 (diff) | |
parent | d41841b4a70fee2068bd6b3dcea04daf9605e5b7 (diff) | |
download | nextcloud-server-fa466a093cef75abaf0696421f4a9b640122242c.tar.gz nextcloud-server-fa466a093cef75abaf0696421f4a9b640122242c.zip |
Merge pull request #33139 from nextcloud/fix/check-calendar-uri-length
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 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, diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 6b60d6701d4..b4fdcf922dc 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -389,6 +389,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, |