diff options
author | Anna Larch <anna@nextcloud.com> | 2023-06-30 11:01:22 +0200 |
---|---|---|
committer | Anna <anna@nextcloud.com> | 2023-08-28 14:19:54 +0200 |
commit | 14725d792f3565b8b407bb8c431e434565e00cf2 (patch) | |
tree | 861a88b85d2be0c165ede166a50837753b8517bb /lib/private/Calendar | |
parent | c2d55ab5f6284313a999c4d71224c0401f04edd4 (diff) | |
download | nextcloud-server-14725d792f3565b8b407bb8c431e434565e00cf2.tar.gz nextcloud-server-14725d792f3565b8b407bb8c431e434565e00cf2.zip |
fix(CalDAV): Check if the vObject exists before attempting any operations
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/private/Calendar')
-rw-r--r-- | lib/private/Calendar/Manager.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index f29920e1793..dc4801c69ce 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -231,11 +231,20 @@ class Manager implements IManager { string $recipient, string $calendarData, ): bool { - /** @var VCalendar $vObject */ + /** @var VCalendar $vObject|null */ $vObject = Reader::read($calendarData); - /** @var VEvent $vEvent */ + + if ($vObject === null) { + return false; + } + + /** @var VEvent|null $vEvent */ $vEvent = $vObject->{'VEVENT'}; + if ($vEvent === null) { + return false; + } + // First, we check if the correct method is passed to us if (strcasecmp('REPLY', $vObject->{'METHOD'}->getValue()) !== 0) { $this->logger->warning('Wrong method provided for processing'); @@ -306,10 +315,20 @@ class Manager implements IManager { string $recipient, string $calendarData, ): bool { + /** @var VCalendar $vObject|null */ $vObject = Reader::read($calendarData); - /** @var VEvent $vEvent */ + + if ($vObject === null) { + return false; + } + + /** @var VEvent|null $vEvent */ $vEvent = $vObject->{'VEVENT'}; + if ($vEvent === null) { + return false; + } + // First, we check if the correct method is passed to us if (strcasecmp('CANCEL', $vObject->{'METHOD'}->getValue()) !== 0) { $this->logger->warning('Wrong method provided for processing'); |