[Pkg-owncloud-commits] [owncloud-client] 55/70: Fix crash: if the credentials cannot be cast, don't deref, assume change

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 17 20:01:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 9f6e9f8e1b29f3e4369dd7503a410d052f2d81f0
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Thu May 15 11:12:09 2014 +0200

    Fix crash: if the credentials cannot be cast, don't deref, assume change
---
 src/creds/httpcredentials.cpp       | 6 +++++-
 src/creds/shibbolethcredentials.cpp | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp
index 3021a09..f5ab3b6 100644
--- a/src/creds/httpcredentials.cpp
+++ b/src/creds/httpcredentials.cpp
@@ -141,7 +141,11 @@ void HttpCredentials::syncContextPreStart (CSYNC* ctx)
 
 bool HttpCredentials::changed(AbstractCredentials* credentials) const
 {
-    HttpCredentials* other(dynamic_cast< HttpCredentials* >(credentials));
+    HttpCredentials* other(qobject_cast< HttpCredentials* >(credentials));
+
+    if (!other) {
+        return true;
+    }
 
     if (!other || (other->user() != this->user())) {
         return true;
diff --git a/src/creds/shibbolethcredentials.cpp b/src/creds/shibbolethcredentials.cpp
index 76cf057..1d93747 100644
--- a/src/creds/shibbolethcredentials.cpp
+++ b/src/creds/shibbolethcredentials.cpp
@@ -125,7 +125,11 @@ void ShibbolethCredentials::syncContextPreStart (CSYNC* ctx)
 
 bool ShibbolethCredentials::changed(AbstractCredentials* credentials) const
 {
-    ShibbolethCredentials* other(dynamic_cast< ShibbolethCredentials* >(credentials));
+    ShibbolethCredentials* other(qobject_cast< ShibbolethCredentials* >(credentials));
+
+    if (!other) {
+        return true;
+    }
 
     if (_shibCookie != other->_shibCookie || _user != other->_user) {
         return true;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list